Build and deploy to PlayStore and GitHub #28
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: Build and deploy to PlayStore and GitHub | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+**' | |
env: | |
BUILD_TOOLS_VERSION: 34.0.0 | |
PRE_RELEASE: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
jobs: | |
build-playstore: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Create google_services.json | |
id: createGoogleServicesJson | |
run: echo '${{ secrets.GOOGLE_SERVICES }}' > app/google-services.json | |
- name: Build Release AAB | |
id: buildRelease | |
run: ./gradlew bundlePlaystoreRelease | |
- name: Sign Release AAB | |
id: sign_app | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/bundle/playstoreRelease | |
signingKeyBase64: ${{ secrets.KEY_STORE }} | |
alias: ${{ secrets.KEY_STORE_ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- name: Create service_account.json | |
id: createServiceAccount | |
run: echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json | |
- name: Publish to Play Store BETA | |
id: publish | |
uses: r0adkll/[email protected] | |
with: | |
serviceAccountJson: service_account.json | |
packageName: be.casperverswijvelt.unifiedinternetqs | |
releaseFile: ${{ env.SIGNED_RELEASE_FILE }} | |
track: beta | |
build-github: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Create google_services.json | |
id: createGoogleServicesJson | |
run: echo '${{ secrets.GOOGLE_SERVICES }}' > app/google-services.json | |
- name: Build Release APK | |
id: buildRelease | |
run: ./gradlew assembleGithubRelease | |
- name: Sign Release APK | |
id: sign_app | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/apk/github/release | |
signingKeyBase64: ${{ secrets.KEY_STORE }} | |
alias: ${{ secrets.KEY_STORE_ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: ${{ env.SIGNED_RELEASE_FILE }} | |
asset_name: app-release-github.apk | |
tag: ${{ github.ref }} | |
overwrite: true | |
prerelease: ${{ env.PRE_RELEASE }} | |
body: "Automatically released using GitHub actions. Release-notes will follow later." |