Deployment Workflow #23
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: Deployment Workflow | |
on: | |
workflow_dispatch: | |
# Job 1 - Build Signed AAB | |
jobs: | |
build: | |
name: Job_1 - Build Signed AAB | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1 - checkout the repository, making it available to the workflow: | |
- uses: actions/checkout@v3 | |
# Step 2 [Optional] - retrieves the contents of API_KEY_PROPERTIES secret from GitHub Secrets | |
# and save it as apikey.properties file in the workflow workspace. | |
- name: Get apikey.properties from secrets | |
run: echo "${{ secrets.API_KEY_PROPERTIES }}" > $GITHUB_WORKSPACE/apikey.properties | |
# Step 3 - Setup Java | |
- name: Setup JDK 20 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 20 | |
# Step 4 - Setup Gradle to allow workflow access and execute Gradlew file | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
# Step 5 - Setup Gradle Cache to improve the speed of the workflows | |
- name: Setup Gradle Cache | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-home-cache-cleanup: true | |
# Step 6 - Override the version code and version name | |
- name: Bump Version Code | |
uses: chkfung/[email protected] | |
with: | |
gradlePath: app/build.gradle.kts | |
versionCode: ${{ github.run_number }} | |
versionName: 1.0.0 | |
# Step 7 - Build Production App Bundle | |
- name: Build prodRelease | |
run: ./gradlew bundleRelease | |
# Step 8 - Sign AAB | |
- name: Sign AAb | |
id: sign | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/bundle/release | |
signingKeyBase64: ${{ secrets.KEYSTORE }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
# Step 9 - Save AAB after Build job is complete to publish it as a Github release in the next job | |
- name: Upload app bundle as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-bundle | |
path: app/build/outputs/bundle/release/app-release.aab | |
# Step 10 - Print out the Job Status | |
- run: echo Build status report=${{ job.status }} | |
# Job 2 - Deploy to Playstore | |
deploy: | |
name: Job_2 - Deploy aab to playstore | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1 - Download app bundle | |
- name: Download app bundle from artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: app-bundle | |
# Step 2- Upload the AAB to play console | |
- name: Publish to Play Store | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} | |
packageName: com.workout_manager | |
releaseFiles: ${{ github.workspace }}/app-release.aab | |
track: production |