|
| 1 | +name: Mobile Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'mobile-v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag_name: |
| 10 | + description: 'Mobile release tag (for example mobile-v1.0.0).' |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: mobile-package-${{ github.event.release.tag_name || inputs.tag_name || github.ref_name }} |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + prepare: |
| 23 | + name: Prepare mobile release |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + tag_name: ${{ steps.meta.outputs.tag_name }} |
| 27 | + version: ${{ steps.meta.outputs.version }} |
| 28 | + prerelease: ${{ steps.meta.outputs.prerelease }} |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v5 |
| 31 | + with: |
| 32 | + ref: ${{ inputs.tag_name || github.ref_name }} |
| 33 | + fetch-depth: 1 |
| 34 | + |
| 35 | + - name: Resolve mobile version |
| 36 | + id: meta |
| 37 | + shell: bash |
| 38 | + env: |
| 39 | + INPUT_TAG_NAME: ${{ inputs.tag_name }} |
| 40 | + REF_NAME: ${{ github.ref_name }} |
| 41 | + run: | |
| 42 | + set -euo pipefail |
| 43 | + TAG="${INPUT_TAG_NAME:-${REF_NAME}}" |
| 44 | + case "$TAG" in |
| 45 | + mobile-v*) ;; |
| 46 | + *) echo "Expected a mobile-v* tag, got $TAG" >&2; exit 1 ;; |
| 47 | + esac |
| 48 | + VERSION="${TAG#mobile-v}" |
| 49 | + node scripts/verify-release-version-sync.mjs --mobile-version "$VERSION" |
| 50 | + if [[ "$VERSION" == *-* ]]; then |
| 51 | + PRERELEASE=true |
| 52 | + else |
| 53 | + PRERELEASE=false |
| 54 | + fi |
| 55 | + printf 'tag_name=%s\nversion=%s\nprerelease=%s\n' \ |
| 56 | + "$TAG" "$VERSION" "$PRERELEASE" >> "$GITHUB_OUTPUT" |
| 57 | +
|
| 58 | + android: |
| 59 | + name: Android package |
| 60 | + needs: prepare |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v5 |
| 64 | + with: |
| 65 | + ref: ${{ needs.prepare.outputs.tag_name }} |
| 66 | + |
| 67 | + - uses: actions/setup-java@v5 |
| 68 | + with: |
| 69 | + distribution: temurin |
| 70 | + java-version: '21' |
| 71 | + |
| 72 | + - uses: gradle/actions/setup-gradle@v4 |
| 73 | + |
| 74 | + - name: Configure Android release signing |
| 75 | + shell: bash |
| 76 | + run: | |
| 77 | + set -euo pipefail |
| 78 | + echo "Using the runner-generated Android debug keystore for this mobile prerelease." |
| 79 | +
|
| 80 | + - name: Build signed Android package |
| 81 | + working-directory: src/apps/mobile/android |
| 82 | + run: ./gradlew :app:assembleRelease --no-daemon |
| 83 | + |
| 84 | + - name: Stage Android release assets |
| 85 | + shell: bash |
| 86 | + env: |
| 87 | + VERSION: ${{ needs.prepare.outputs.version }} |
| 88 | + run: | |
| 89 | + set -euo pipefail |
| 90 | + mkdir -p mobile-release-assets |
| 91 | + suffix='-debug' |
| 92 | + cp src/apps/mobile/android/app/build/outputs/apk/release/app-release.apk \ |
| 93 | + "mobile-release-assets/OpenBitFun-Mobile-${VERSION}-android${suffix}.apk" |
| 94 | + (cd mobile-release-assets && sha256sum ./*.apk > SHA256SUMS) |
| 95 | +
|
| 96 | + - uses: actions/upload-artifact@v6 |
| 97 | + with: |
| 98 | + name: openbitfun-mobile-${{ needs.prepare.outputs.tag_name }}-android |
| 99 | + path: mobile-release-assets/* |
| 100 | + if-no-files-found: error |
| 101 | + retention-days: 7 |
| 102 | + |
| 103 | + publish: |
| 104 | + name: Publish mobile release |
| 105 | + needs: [prepare, android] |
| 106 | + runs-on: ubuntu-latest |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v5 |
| 109 | + with: |
| 110 | + ref: ${{ needs.prepare.outputs.tag_name }} |
| 111 | + |
| 112 | + - uses: actions/download-artifact@v7 |
| 113 | + with: |
| 114 | + name: openbitfun-mobile-${{ needs.prepare.outputs.tag_name }}-android |
| 115 | + path: mobile-release-assets |
| 116 | + |
| 117 | + - name: Create mobile release |
| 118 | + env: |
| 119 | + GH_TOKEN: ${{ github.token }} |
| 120 | + TAG_NAME: ${{ needs.prepare.outputs.tag_name }} |
| 121 | + VERSION: ${{ needs.prepare.outputs.version }} |
| 122 | + PRERELEASE: true |
| 123 | + shell: bash |
| 124 | + run: | |
| 125 | + set -euo pipefail |
| 126 | + VERSION="$VERSION (debug signing)" |
| 127 | + gh release create "$TAG_NAME" \ |
| 128 | + --repo "$GITHUB_REPOSITORY" \ |
| 129 | + --verify-tag \ |
| 130 | + --title "OpenBitFun Mobile $VERSION" \ |
| 131 | + --generate-notes \ |
| 132 | + --prerelease="$PRERELEASE" \ |
| 133 | + mobile-release-assets/* |
0 commit comments