Fix provisioning mistake #606
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: Build Android | |
on: | |
push: | |
jobs: | |
wait: | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
name: Queue Android builds | |
runs-on: ubuntu-latest | |
steps: | |
# We do this so we don't ever have conflicting build numbers | |
- uses: ahmadnassri/action-workflow-queue@v1 | |
with: | |
delay: 60000 | |
timeout: 3600000 | |
build: | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
name: Build Android | |
needs: wait | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Setup java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Extract Android signing key from env | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64 }}" > android/release.jks.base64 | |
base64 -d android/release.jks.base64 > android/release.jks | |
- name: Build web app | |
run: | | |
npm install | |
npm run deploy-check | |
npm run build | |
- name: Get & update build number | |
run: | | |
echo "PACKAGE_NUMBER=$(jq -r '.version' package.json)" >> "$GITHUB_ENV" | |
echo "BUILD_NUMBER=$((${{ vars.ANDROID_BUILD_NUMBER }} + 1))" >> "$GITHUB_ENV" | |
- name: Update build number | |
run: | | |
curl -L -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.API_TOKEN }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/acc-hymns/actions/variables/ANDROID_BUILD_NUMBER -d '{"value":"${{ env.BUILD_NUMBER }}"}' | |
- name: Build app bundle | |
run: | | |
npx cap sync android | |
# Replace version codes | |
sed -i -E "s/versionCode ([0-9]+?)/versionCode ${{ env.BUILD_NUMBER}}/g" android/app/build.gradle | |
sed -i -E "s/versionName \"(.+?)\"/versionName \"${{ env.PACKAGE_NUMBER}}\"/g" android/app/build.gradle | |
chmod +x ./android/gradlew | |
npx cap build android --keystorepath release.jks --keystorepass ${{ secrets.KEYSTORE_PASSWORD }} --keystorealias upload-keystore --keystorealiaspass ${{ secrets.KEYSTORE_PASSWORD }} --androidreleasetype APK | |
npx cap build android --keystorepath release.jks --keystorepass ${{ secrets.KEYSTORE_PASSWORD }} --keystorealias upload-keystore --keystorealiaspass ${{ secrets.KEYSTORE_PASSWORD }} --androidreleasetype AAB | |
- name: Publish AAB | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }} | |
releaseFiles: ./android/app/build/outputs/bundle/release/app-release-signed.aab | |
packageName: com.ChristopherW.acchmns | |
track: internal | |
- name: Upload release AAB | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-release-aab | |
path: android/app/build/outputs/bundle/release/app-release-signed.aab | |
retention-days: 7 | |
- name: Upload release APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-release-apk | |
path: android/app/build/outputs/apk/release/app-release-signed.apk | |
retention-days: 7 |