Build an android app #48
This file contains hidden or 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: Build an android app | |
on: | |
# push: | |
# branches: | |
# - capacitor | |
schedule: | |
# Every week | |
- cron: '0 0 * * 0' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
# Release upload permission | |
contents: write | |
jobs: | |
build-app: | |
runs-on: ubuntu-latest | |
if: github.repository == 'MultiMote/niimblue' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: npm | |
cache-dependency-path: ./package-lock.json | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
with: | |
log-accepted-android-sdk-licenses: false | |
- name: Add build tools to PATH for apksigner | |
run: echo "$ANDROID_HOME/build-tools/34.0.0" >> $GITHUB_PATH | |
- name: Decode Keystore | |
run: mkdir -p .keystore && echo $KEYSTORE_BASE_64 | base64 -d > .keystore/keystore.jks | |
env: | |
KEYSTORE_BASE_64: ${{ secrets.KEYSTORE_BASE_64 }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Install capacitor dependencies | |
working-directory: ./capacitor | |
run: npm ci | |
- name: Build niimblue www | |
working-directory: ./capacitor | |
run: npm run build-www | |
- name: Build and sign capacitor app | |
working-directory: ./capacitor | |
run: npm run build-android | |
env: | |
KEYSTORE_PATH: ${{ github.workspace }}/.keystore/keystore.jks | |
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }} | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
APP_VERSION_CODE: ${{ github.run_number }} | |
- name: Upload apk to Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app | |
path: ./capacitor/android/app/build/outputs/apk/release/app-release-signed.apk | |
- name: Update release | |
run: gh release upload snapshot ./capacitor/android/app/build/outputs/apk/release/app-release-signed.apk -R ${{github.repository}} --clobber | |