Files
MaaAssistantArknights/.github/workflows/release-ota.yml
dependabot[bot] 3b3383ef4b ci: bump the github-actions group in /.github/workflows with 4 updates (#15091)
Bumps the github-actions group in /.github/workflows with 4 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/cache](https://github.com/actions/cache), [actions/download-artifact](https://github.com/actions/download-artifact) and [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request).


Updates `actions/upload-artifact` from 5 to 6
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

Updates `actions/cache` from 4 to 5
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

Updates `actions/download-artifact` from 6 to 7
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v6...v7)

Updates `peter-evans/create-pull-request` from 7 to 8
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: peter-evans/create-pull-request
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-15 18:44:55 +01:00

216 lines
7.9 KiB
YAML

name: Release Pipeline (OTA)
on:
release:
types:
- published
workflow_dispatch:
inputs:
limit:
description: Number of releases to fetch from MaaAssistantArknights, 2 at least
required: false
default: 31
type: number
limit_2:
description: Number of releases to fetch from MaaRelease
required: false
default: 30
type: number
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
create-tag:
name: Create OTA Release Tag in MaaRelease
runs-on: ubuntu-latest
steps:
- name: Checkout MaaRelease
uses: actions/checkout@v6
with:
show-progress: false
repository: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
path: MaaRelease
fetch-depth: 0
token: ${{ secrets.MAARELEASE_RELEASE }}
- name: Fetch release information
id: fetchReleaseInfo
run: |
mkdir -pv build-ota && cd build-ota
# Convert inputs to integers
limit=${{ inputs.limit || 31 }}
limit=${limit%.*}
echo "Parsed limit: $limit"
limit_2=${{ inputs.limit_2 || 30 }}
limit_2=${limit_2%.*}
echo "Parsed limit_2: $limit_2"
gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit $limit | tee ./release_maa.txt
gh release list --repo "MaaAssistantArknights/MaaRelease" --limit $limit_2 | tee ./release_mr.txt
head -n 1 ./release_maa.txt | awk '{ print $1 }' > ./config
tail -n +1 ./release_maa.txt | awk '{ print $1 }' > ./tags_maa.txt
cat ./release_mr.txt | awk '{ print $1 }' > ./tags_mr.txt
comm <(sort ./tags_maa.txt) <(sort ./tags_mr.txt) | awk '{ print $1 }' >> ./config
echo "config:"
cat ./config
echo "prerelease=$([ $(head -n 1 release_maa.txt | awk '{ print $2}') = 'Pre-release' ] && echo true || echo false)" >> $GITHUB_OUTPUT
echo "release_tag=$(head -n 1 ./config)" >> $GITHUB_OUTPUT
- name: Commit and setup tag
run: |
cd MaaRelease
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git checkout --orphan __temp
git rm -rf .
git commit --allow-empty --message ${{ steps.fetchReleaseInfo.outputs.release_tag }}
git tag ${{ steps.fetchReleaseInfo.outputs.release_tag }} || exit 0 # do nothing if the tag already exists
git push --tags
env:
PUSH_REMOTE: https://github-actions[bot]:${{ secrets.MAARELEASE_RELEASE }}@github.com/${{ github.repository_owner }}/MaaRelease
- name: Upload release config to GitHub
uses: actions/upload-artifact@v6
with:
name: MaaReleaseConfig
path: ./build-ota/config
outputs:
prerelease: ${{ steps.fetchReleaseInfo.outputs.prerelease }}
release_tag: ${{ steps.fetchReleaseInfo.outputs.release_tag }}
make-ota:
name: Build and Upload OTA for Windows
needs: create-tag
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x64
steps:
- name: Download release config
uses: actions/download-artifact@v7
with:
name: MaaReleaseConfig
path: ./MaaReleaseConfig
- name: Checkout MaaRelease
uses: actions/checkout@v6
with:
show-progress: false
repository: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
path: MaaRelease
fetch-depth: 0
token: ${{ secrets.MAARELEASE_RELEASE }}
- name: Checkout repository
uses: actions/checkout@v6
with:
show-progress: false
path: MaaAssistantArknights
- name: Download latest version for server
run: |
mkdir -pv build-ota/${{ needs.create-tag.outputs.release_tag }}
cd build-ota/${{ needs.create-tag.outputs.release_tag }}
gh release download ${{ needs.create-tag.outputs.release_tag }} --repo 'MaaAssistantArknights/MaaAssistantArknights' --pattern "MAA-${{ needs.create-tag.outputs.release_tag }}-win-${{ matrix.target }}.zip" --clobber
cp *.zip ..
- name: Build OTA
run: |
cd build-ota
$GITHUB_WORKSPACE/MaaAssistantArknights/tools/OTAPacker/build.sh 'MaaAssistantArknights/MaaAssistantArknights' ../MaaReleaseConfig/config ${{ matrix.target }} 'MaaAssistantArknights/MaaRelease'
- name: Upload to MaaRelease
uses: svenstaro/upload-release-action@v2
with:
repo_name: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
repo_token: ${{ secrets.MAARELEASE_RELEASE }}
file_glob: true
file: build-ota/*.zip
tag: ${{ needs.create-tag.outputs.release_tag }}
prerelease: ${{ fromJSON(needs.create-tag.outputs.prerelease) }}
overwrite: true
- name: Create issue on failure
if: failure()
uses: actions-cool/issues-helper@v3
with:
actions: "create-issue"
title: "Failed to make OTA release for Windows"
body: |
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
make-ota-mac:
name: Build and Upload OTA for macOS
needs: create-tag
runs-on: macos-14
steps:
- name: Fetch release information
run: gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit ${{ inputs.limit || 31 }} | tee ./release_maa.txt
- name: Download release packages
run: |
cat ./release_maa.txt | awk '{ print $1 }' | while read tag; do
gh release download "$tag" --repo 'MaaAssistantArknights/MaaAssistantArknights' --clobber -D packages -p 'MAA-*-macos-universal.dmg' || true
RELEASE_NOTES=$(gh release view "$tag" --repo 'MaaAssistantArknights/MaaAssistantArknights' --json body --jq .body)
gh api /markdown -f text="$RELEASE_NOTES" | tee ./packages/MAA-"$tag"-macos-universal.html
done
curl -fsSL -o packages/appcast.xml https://maa-release.hguandl.com/macos/appcast.xml
- name: Setup Sparkle
run: |
gh release download --repo 'sparkle-project/Sparkle' --clobber -O - -p 'Sparkle-*.tar.xz' | tar xf -
- name: Generate update packages
run: |
if [ $(head -n 1 release_maa.txt | awk '{ print $2 }') = 'Pre-release' ]; then
echo ${{ secrets.SPARKLE_PRIV_KEY }} | ./bin/generate_appcast --channel beta --ed-key-file - ./packages
else
echo ${{ secrets.SPARKLE_PRIV_KEY }} | ./bin/generate_appcast --ed-key-file - ./packages
fi
- name: Clean up files
run: |
find ./packages -type f ! \( -name 'MAA-${{ needs.create-tag.outputs.release_tag }}-macos-universal.dmg' -o -name '*.delta' -o -name '*.xml' \) -print -delete
- name: Upload to MaaRelease
uses: svenstaro/upload-release-action@v2
with:
repo_name: ${{ format('{0}/{1}', github.repository_owner, 'MaaRelease') }}
repo_token: ${{ secrets.MAARELEASE_RELEASE }}
file_glob: true
file: packages/*
tag: ${{ needs.create-tag.outputs.release_tag }}
prerelease: ${{ fromJSON(needs.create-tag.outputs.prerelease) }}
overwrite: true
- name: Create issue on failure
if: failure()
uses: actions-cool/issues-helper@v3
with:
actions: "create-issue"
title: "Failed to make OTA release for macOS"
body: |
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
release:
name: Publish to Release Mirrors
needs:
- make-ota
- make-ota-mac
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }}
steps:
- name: Setup release mirror
run: |
gh workflow --repo MaaAssistantArknights/MaaRelease run release-mirrors.yml