Skip to content

Implemented a script to hardcode VersionCode and VersionName in f… #51

Implemented a script to hardcode VersionCode and VersionName in f…

Implemented a script to hardcode VersionCode and VersionName in f… #51

Workflow file for this run

name: Build & Publish APK
on:
push:
branches:
- main
paths:
- 'app/**/*'
- 'gradle/**/*'
- 'build.gradle.kts'
- '.github/workflows/android.yml'
- 'fastlane/Appfile'
- 'fastlane/Fastfile'
- 'fastlane/Pluginfile'
jobs:
build:
name: Release build
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_ACCESS_TOKEN }}
- name: Set version code
run: |
${{ github.workspace }}/app/setVersionCodes.sh
EXIT_CODE=$?
git add -A && git commit 'updated version code' && git push
exit $EXIT_CODE
- name: setup jdk
uses: actions/setup-java@v1
with:
java-version: 17
# - name: Make Gradle executable
# run: chmod +x ./gradlew
# - name: Build Release APK
# run: ./gradlew assembleRelease
# - name: Build Debug APK
# run: ./gradlew assembleDebug
- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.3
bundler-cache: true
# - name: Run tests
# run: bundle exec fastlane android test
- name: Decode Keystore File
uses: timheuer/base64-to-file@v1
id: android_keystore
with:
fileName: "android_keystore.keystore"
encodedString: ${{ secrets.KEYSTORE_FILE }}
- name: Build release bundle
run: bundle exec fastlane android build
env:
KEYSTORE_FILE: ${{ steps.android_keystore.outputs.filePath }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS}}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Build release apk
run: bundle exec fastlane android assemble
env:
KEYSTORE_FILE: ${{ steps.android_keystore.outputs.filePath }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS}}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: release-bundle
path: |
${{ github.workspace }}/app/build/outputs/bundle/release
- uses: actions/upload-artifact@v2
with:
name: release-apk
path: |
${{ github.workspace }}/app/build/outputs/apk/release
google_play:
name: Deploy to Google Play
needs: build
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: release-bundle
path: |
${{ github.workspace }}/app/build/outputs/bundle/release
- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.3
bundler-cache: true
- name: Decode Service Account Key JSON File
uses: timheuer/base64-to-file@v1
id: service_account_json_file
with:
fileName: "serviceAccount.json"
encodedString: ${{ secrets.GPLAY_SERVICE_ACCOUNT_KEY_JSON }}
- name: Deploy to Google Play
run: bundle exec fastlane android deploy
env:
ANDROID_JSON_KEY_FILE: ${{ steps.service_account_json_file.outputs.filePath }}
release:
name: Create a new release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: release-bundle
path: |
${{ github.workspace }}/app/build/outputs/bundle/release
- uses: actions/download-artifact@v2
with:
name: release-apk
path: |
${{ github.workspace }}/app/build/outputs/apk/release
- name: version
run: source app/version.properties && echo "CUR_VERSION=$VERSION" >> $GITHUB_OUTPUT
id: version
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
make_latest: true
tag_name: ${{ steps.version.outputs.CUR_VERSION }}
files: |
app/build/outputs/bundle/release/app-release.aab
app/build/outputs/apk/release/app-release.apk