Skip to content

scottenock has triggered an Android Release #16

scottenock has triggered an Android Release

scottenock has triggered an Android Release #16

Workflow file for this run

name: Release APK
run-name: ${{ github.actor }} has triggered an Android Release
on:
release:
types: [published]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Use Java
uses: actions/setup-java@v4
with:
distribution: "corretto"
java-version: "17"
- name: Install xmlstarlet
run: |
sudo apt update
sudo apt install xmlstarlet
- run: npm ci
- run: npm test
- run: npm run build --if-present
- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
with:
fileName: "keystore.jks"
encodedString: ${{ secrets.KEYSTORE }}
- name: Extract release version
id: extract_tag
run: echo "TAG_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
- name: Update config.xml
run: |
xmlstarlet ed -N w="http://www.w3.org/ns/widgets" -u "/w:widget/@version" -v "${{ env.TAG_VERSION }}" cordova/config.xml > cordova/newConfig.xml
mv cordova/newConfig.xml cordova/config.xml
- name: build APK
run: |
cd cordova
npm i -D cordova
npx cordova platform add android@13
npx cordova build android --release -- --keystore="${{ steps.decode_keystore.outputs.filePath }}" --storePassword="${{ secrets.SIGNING_STORE_PASSWORD }}" --alias="${{ secrets.SIGNING_KEY_ALIAS }}" --password="${{ secrets.SIGNING_KEY_PASSWORD }}"
- name: Upload Release Build
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: cordova/platforms/android/app/build/outputs/bundle/release/app-release.aab
- name: Commit config.xml
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git fetch
git checkout master
git pull
xmlstarlet ed -N w="http://www.w3.org/ns/widgets" -u "/w:widget/@version" -v "${{ env.TAG_VERSION }}" cordova/config.xml > cordova/newConfig.xml
mv cordova/newConfig.xml cordova/config.xml
git add cordova/config.xml
git commit -m "CHORE: update config.xml" && git push || echo "config.xml has not changed. Nothing to commit."