chore(ci): mirror release assets to GitCode (#1797)
## Summary Adds GitCode Release mirroring for AIRI release assets. - Adds a reusable `.github/scripts/publish-gitcode-release.sh` helper that creates or reuses the matching GitCode release, compares GitHub and GitCode asset names, downloads only missing `AIRI-*` and `latest-*.yml` assets, uploads them through GitCode's upload URL API, and verifies the final asset list. - Hooks the mirror step into desktop, Android, and iOS release workflows so assets produced by separate release jobs can converge on the same GitCode release. - Keeps the mirror idempotent so repeated or concurrent release workflows skip already mirrored files. ## Why GitHub Releases are slow for many mainland China users. GitCode provides a domestic fallback release page, but manually copying installers after every release is error-prone and tedious. ## Validation - `bash -n .github/scripts/publish-gitcode-release.sh` - YAML parsing for: - `.github/workflows/release-tamagotchi.yml` - `.github/workflows/release-pocket-android.yml` - `.github/workflows/release-pocket-ios.yml` - `git diff --check -- .github/scripts/publish-gitcode-release.sh .github/workflows/release-tamagotchi.yml .github/workflows/release-pocket-android.yml .github/workflows/release-pocket-ios.yml` - Local idempotency check against existing `v0.10.1` GitHub/GitCode releases: - GitCode release already exists - all mirrored assets already present - final asset verification passed ## Setup Required The target repository needs these GitHub Secrets: - `GITCODE_TOKEN` - `GITCODE_OWNER` - `GITCODE_REPO` For the current GitCode project, `GITCODE_OWNER` should remain `MoeruAI` because GitCode's API and release download paths currently resolve that namespace even though the UI displays `moeru-ai`.
This commit is contained in:
@@ -108,6 +108,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload to GitHub Releases
|
||||
id: upload-github-release
|
||||
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.build_only) }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
@@ -124,3 +125,14 @@ jobs:
|
||||
run: butler push apps/stage-pocket/android/bundle/${{ env.APK_NAME }} nekomeowww/airi:android --userversion ${{ env.VERSION }}
|
||||
env:
|
||||
BUTLER_API_KEY: ${{ secrets.GAME_PUBLISHING_ITCHIO }}
|
||||
|
||||
- name: Publish release assets to GitCode
|
||||
if: ${{ always() && github.repository == 'moeru-ai/airi' && steps.upload-github-release.outcome == 'success' && (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.build_only)) }}
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }}
|
||||
GITCODE_OWNER: ${{ secrets.GITCODE_OWNER }}
|
||||
GITCODE_REPO: ${{ secrets.GITCODE_REPO }}
|
||||
GITCODE_RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
|
||||
run: bash .github/scripts/publish-gitcode-release.sh
|
||||
|
||||
@@ -156,3 +156,27 @@ jobs:
|
||||
security delete-keychain "$KEYCHAIN_PATH" 2>/dev/null || true
|
||||
fi
|
||||
rm -f ~/Library/MobileDevice/Provisioning\ Profiles/*.mobileprovision
|
||||
|
||||
publish-gitcode-release:
|
||||
name: Publish GitCode Release Mirror
|
||||
needs: build
|
||||
if: ${{ always() && github.repository == 'moeru-ai/airi' && needs.build.result == 'success' && (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.tag != '')) }}
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Validate release mirror tools
|
||||
run: |
|
||||
gh --version
|
||||
jq --version
|
||||
curl --version
|
||||
|
||||
- name: Publish release assets to GitCode
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }}
|
||||
GITCODE_OWNER: ${{ secrets.GITCODE_OWNER }}
|
||||
GITCODE_REPO: ${{ secrets.GITCODE_REPO }}
|
||||
GITCODE_RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
|
||||
run: bash .github/scripts/publish-gitcode-release.sh
|
||||
|
||||
@@ -531,6 +531,30 @@ jobs:
|
||||
apps/stage-tamagotchi/bundle/latest-*.yml
|
||||
append_body: true
|
||||
|
||||
publish-gitcode-release:
|
||||
name: Publish GitCode Release Mirror
|
||||
needs: build
|
||||
if: ${{ always() && github.repository == 'moeru-ai/airi' && (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.build_only && !inputs.artifacts_only && inputs.tag != '')) }}
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Validate release mirror tools
|
||||
run: |
|
||||
gh --version
|
||||
jq --version
|
||||
curl --version
|
||||
|
||||
- name: Publish release assets to GitCode
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }}
|
||||
GITCODE_OWNER: ${{ secrets.GITCODE_OWNER }}
|
||||
GITCODE_REPO: ${{ secrets.GITCODE_REPO }}
|
||||
GITCODE_RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
|
||||
run: bash .github/scripts/publish-gitcode-release.sh
|
||||
|
||||
publish-distribution:
|
||||
name: Publish Distribution
|
||||
needs: build
|
||||
|
||||
Reference in New Issue
Block a user