Create Android APK #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Android APK | |
on: | |
workflow_dispatch: | |
inputs: | |
versionBumpType: | |
description: "Version bump type (major, minor, patch)" | |
required: true | |
default: "minor" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Bump version | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
npm version ${{ github.event.inputs.versionBumpType }} | |
git push origin master | |
echo "NEW_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
- name: Unpack data | |
env: | |
ZIP_PASSWORD: ${{ secrets.ZIP_PASSWORD }} | |
run: | | |
ls | |
unzip -P "$ZIP_PASSWORD" ./compendium_archive.zip -d src/data | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Install deps | |
run: | | |
npm install | |
- name: Build Android APK | |
run: | | |
./gradlew assembleRelease | |
working-directory: android | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.NEW_VERSION }} | |
release_name: Release v${{ env.NEW_VERSION }} | |
draft: false | |
prerelease: false | |
- name: Upload APK | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: android/app/build/outputs/apk/release/app-release.apk | |
asset_name: app-release.apk | |
asset_content_type: application/vnd.android.package-archive |