Capacitor [Android] #239
Workflow file for this run
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: Capacitor [Android] | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
workflow_dispatch: | |
env: | |
GH_TOKEN: ${{ secrets.github_token }} | |
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
ANDROID_KEYSTORE_PATH: './app.keystore' # relative to `./android` dir | |
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} | |
ANDROID_KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_ALIAS_PASSWORD }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up JDK LTS | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'jetbrains' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Install ApkSigner | |
run: sudo apt install -y apksigner | |
- name: Setup Node version 🍀 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies ⚙️ | |
run: npm ci | |
- name: Build PWA | |
run: | | |
npm run schema:generate | |
npm run android:prebuild | |
- name: Extract Android signing key from ENV 🔑 | |
run: | | |
echo "$ANDROID_KEYSTORE_BASE64" > android/keystore.base64 | |
base64 -d android/keystore.base64 > android/app.keystore | |
rm android/keystore.base64 | |
- name: Build and Sign Android App (APK) 🛠️ | |
run: | | |
npx cap sync | |
npx cap build android \ | |
--keystorepath $ANDROID_KEYSTORE_PATH \ | |
--keystorepass $ANDROID_KEYSTORE_PASSWORD \ | |
--keystorealias $ANDROID_KEYSTORE_ALIAS \ | |
--keystorealiaspass $ANDROID_KEYSTORE_ALIAS_PASSWORD \ | |
--androidreleasetype APK \ | |
--signing-type apksigner | |
- name: Build and Sign Android App (AAB) 🛠️ | |
run: | | |
npx cap sync | |
npx cap build android \ | |
--keystorepath $ANDROID_KEYSTORE_PATH \ | |
--keystorepass $ANDROID_KEYSTORE_PASSWORD \ | |
--keystorealias $ANDROID_KEYSTORE_ALIAS \ | |
--keystorealiaspass $ANDROID_KEYSTORE_ALIAS_PASSWORD \ | |
--androidreleasetype AAB | |
- name: Save artifacts 💾 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-release-app | |
path: | | |
android/app/build/outputs/apk/release/* | |
android/app/build/outputs/bundle/release/* | |
- name: Clean Keystore file 🧹 | |
run: | | |
rm android/app.keystore |