Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build APK on PR #42

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
pull_request: { types: [ opened, synchronize ] }

jobs:
build:
name: Build
uses: ./.github/workflows/build-apk.yml
with:
version-name: ${{ github.sha }}
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: Pull request artifacts
uses: gavv/pull-request-artifacts@v2
with:
# Commit hash that triggered PR
commit: ${{ github.event.pull_request.head.sha }}
# Token for current repo (used to post PR comment)
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifacts-branch: artifacts
artifacts: |
./apk/release/app-release.apk
./bundle/release/app-release.aab
33 changes: 33 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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: 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
Loading