diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml new file mode 100644 index 0000000..17a1f8c --- /dev/null +++ b/.github/workflows/android-release.yml @@ -0,0 +1,77 @@ +name: Android Release + +on: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + tag: + description: "Existing tag to publish the APK to" + required: true + type: string + +permissions: + contents: write + +jobs: + build-and-release: + runs-on: ubuntu-latest + + env: + RELEASE_TAG: ${{ inputs.tag || github.ref_name }} + EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Checkout selected tag + if: ${{ github.event_name == 'workflow_dispatch' }} + run: git checkout "refs/tags/${{ inputs.tag }}" + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: "pnpm" + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + cache: gradle + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build release APK + run: ./gradlew assembleRelease + working-directory: native-app/android + + - name: Prepare APK asset + run: cp native-app/android/app/build/outputs/apk/release/app-release.apk helium-android-${{ env.RELEASE_TAG }}.apk + + - name: Upload APK artifact + uses: actions/upload-artifact@v4 + with: + name: helium-android-${{ env.RELEASE_TAG }} + path: helium-android-${{ env.RELEASE_TAG }}.apk + if-no-files-found: error + + - name: Upload APK to GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.RELEASE_TAG }} + files: helium-android-${{ env.RELEASE_TAG }}.apk + fail_on_unmatched_files: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}