should work #8
Workflow file for this run
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: Android Build | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
ACTIONS_RUNNER_DEBUG: true | |
ACTIONS_STEP_DEBUG: true | |
APP_NAME: "shockwallet" # Hardcoded app name | |
VERSION: ${{ github.ref_name }} # Use the tag name as the version | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install deps | |
run: | | |
npm ci | |
npm install -g @ionic/cli native-run cordova-res | |
- name: Set up environment | |
run: cp .env.production.example .env | |
- name: Run pre-build script | |
run: npm run prebuild | |
- name: Build Android app | |
run: ionic cap build android --no-interactive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Make gradlew executable | |
run: chmod +x ./android/gradlew | |
- name: Build with Gradle | |
run: | | |
cd android | |
./gradlew assembleRelease | |
- name: Sign APK | |
run: | | |
echo ${{ secrets.ANDROID_KEYSTORE }} | base64 --decode > my-release-key.keystore | |
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore -storepass ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} -keypass ${{ secrets.ANDROID_KEY_PASSWORD }} android/app/build/outputs/apk/release/app-release-unsigned.apk ${{ secrets.ANDROID_KEY_ALIAS }} | |
zipalign -v 4 android/app/build/outputs/apk/release/app-release-unsigned.apk android/app/build/outputs/apk/release/${{ env.APP_NAME }}-${{ env.VERSION }}.apk | |
- name: Upload APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-release | |
path: android/app/build/outputs/apk/release/${{ env.APP_NAME }}-${{ env.VERSION }}.apk |