Skip to content

Commit

Permalink
[ci] some experiments with apk building
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Feb 12, 2024
1 parent fad7557 commit 99e547e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 30 deletions.
60 changes: 33 additions & 27 deletions .github/workflows/build-apk.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
name: Build Release APK
name: Build APK

on:
push:
branches: master
tags:
- v*
workflow_call:
inputs:
version-name:
required: true
type: string
secrets:
google-services-json:
required: true
signing-key-store-base64:
required: true
signing-key-alias:
required: true
signing-key-password:
required: true
signing-store-password:
required: true

jobs:
release_build:
build-apk:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write

steps:
- uses: actions/checkout@v4
Expand All @@ -29,17 +42,18 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}

- name: Setup Google Services
run: echo ${{ secrets.GOOGLE_SERVICES_JSON }} | base64 --decode > ./app/google-services.json
run: echo ${{ secrets.google-services-json }} | base64 --decode > ./app/google-services.json

- name: Set App Version
run: |
sed -i "s/versionName.*/versionName \"${GITHUB_REF_NAME#v}\"/" app/build.gradle
export VERSION_NAME='${{ inputs.version-name }}'
sed -i "s/versionName.*/versionName \"${VERSION_NAME#v}\"/" app/build.gradle
sed -i "s/versionCode.*/versionCode $(( ($(date +%s) - $(date -d "2022-06-15" +%s)) / 86400 ))/" app/build.gradle
#1
- name: Decode Keystore
env:
ENCODED_STRING: ${{ secrets.SIGNING_KEY_STORE_BASE64 }}
ENCODED_STRING: ${{ secrets.signing-key-store-base64 }}
SIGNING_KEY_STORE_PATH: app/keystore.jks

run: |
Expand All @@ -49,18 +63,18 @@ jobs:
#2
- name: Build Release apk
env:
SIGNING_KEY_STORE_PATH: ${{ secrets.SIGNING_KEY_STORE_PATH }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_STORE_PATH: app/keystore.jks
SIGNING_KEY_ALIAS: ${{ secrets.signing-key-alias }}
SIGNING_KEY_PASSWORD: ${{ secrets.signing-key-password }}
SIGNING_STORE_PASSWORD: ${{ secrets.signing-store-password }}
run: ./gradlew assembleRelease

- name: Build Release bundle
env:
SIGNING_KEY_STORE_PATH: ${{ secrets.SIGNING_KEY_STORE_PATH }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_STORE_PATH: app/keystore.jks
SIGNING_KEY_ALIAS: ${{ secrets.signing-key-alias }}
SIGNING_KEY_PASSWORD: ${{ secrets.signing-key-password }}
SIGNING_STORE_PASSWORD: ${{ secrets.signing-store-password }}
run: ./gradlew bundleRelease
#3
- name: Upload Release Build to Artifacts
Expand All @@ -70,12 +84,4 @@ jobs:
path: |
app/build/outputs/apk/release/
app/build/outputs/bundle/release/
#4
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
prerelease: true
files: |
app/build/outputs/apk/release/app-release.apk
app/build/outputs/bundle/release/app-release.aab
5 changes: 2 additions & 3 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Publish Docs

on:
push:
tags:
- "v*"
release:
types: [ published ]

jobs:
build:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
release:
types: [ published ]

jobs:
build:
name: Build
uses: ./.github/workflows/build-apk.yml
with:
version-name: ${{ github.ref_name }}
secrets:
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}
signing-key-store-base64: ${{ secrets.SIGNING_KEY_STORE_BASE64 }}
signing-key-alias: ${{ secrets.SIGNING_KEY_ALIAS }}
signing-key-password: ${{ secrets.SIGNING_KEY_PASSWORD }}
signing-store-password: ${{ secrets.SIGNING_STORE_PASSWORD }}
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v3
with:
name: release-artifacts
- name: Display structure of downloaded files
run: ls -R
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
prerelease: true
files: |
./apk/release/app-release.apk
./bundle/release/app-release.aab

0 comments on commit 99e547e

Please sign in to comment.