-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow to automatically deploy apks
- Loading branch information
hoeveid
committed
Aug 4, 2024
1 parent
f581ac9
commit 32208c4
Showing
1 changed file
with
14 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
# written in such a way that same file can be used in obbimi/Squore, obbimi/TennisPadel, obbimit/Tabletennis etc | ||
name: Build APK & Create Release | ||
|
||
on: | ||
workflow_dispatch: # run manually | ||
inputs: | ||
brand: | ||
description: 'The brand to build: Squore/TennisPadel/Tabletennis/Badminton/Racketlon' | ||
default: "TennisPadel" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
|
@@ -25,32 +20,28 @@ jobs: | |
- name: Checkout the code | ||
uses: actions/[email protected] | ||
with: | ||
repository: obbimi/Squore # overwrite the default ${{ github.repository }} | ||
repository: obbimi/Squore # overwrite the default ${{ github.repository }}. Our java code/resources is always in the Squore repo | ||
#ref: main | ||
|
||
- name: Make pipeline script files executable where needed | ||
run: chmod +x ./gradlew ./build.gradle.adapt.for.github.workflow.sh ./change.R.package.sh | ||
|
||
- name: Adapt build.gradle and google-services.json by means of script | ||
- name: Prepare for build | ||
id: prepare_for_build | ||
env: | ||
GSM_API_KEY: ${{ secrets.GSM_API_KEY }} | ||
run: ./build.gradle.adapt.for.github.workflow.sh ${GSM_API_KEY} | ||
|
||
- name: adapt sources and res files to build different brand | ||
run: | | ||
run: | | ||
set -x | ||
# make support files executable | ||
chmod +x ./gradlew ./build.gradle.adapt.for.github.workflow.sh ./change.R.package.sh | ||
./build.gradle.adapt.for.github.workflow.sh ${GSM_API_KEY} | ||
# adapt sources and res files to build different brand | ||
brand=$(echo "${{ github.repository }}" | cut -d '/' -f 2) | ||
./change.R.package.sh ${brand} | ||
- name: Extract the version from build.gradle | ||
id: extract_version | ||
run: | | ||
set -x | ||
# Extract the version from build.gradle | ||
VERSION=$(grep '^\s*versionCode' build.gradle | cut -d '+' -f 2 | sort -u | tr -d ' ') | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
- name: Build unsigned release .apk files | ||
run: ./gradlew build | ||
run: | | ||
./gradlew build | ||
- name: Sign .apk files | ||
env: | ||
|
@@ -64,7 +55,7 @@ jobs: | |
androidhome="${ANDROID_HOME:-${ANDROID_SDK}}" | ||
for unsignedFn in build/outputs/apk/*/release/*.apk; do | ||
unbrandedSignedFn=${unsignedFn/release-unsigned/release-signed} | ||
signedFn=${unbrandedSignedFn/${baseBrand}/${brand}} | ||
signedFn=${unbrandedSignedFn/${baseBrand}/${brand}.${{ steps.prepare_for_build.outputs.version }}} | ||
${androidhome}/build-tools/$(ls ${androidhome}/build-tools/ | tail -1)/apksigner sign --ks apksign.keystore --ks-pass pass:"${KEYSTORE_PASSWORD}" --out "${signedFn}" "${unsignedFn}" | ||
done | ||
rm -v apksign.keystore | ||
|
@@ -74,7 +65,7 @@ jobs: | |
with: | ||
draft: true # Sets the release as a draft instead of publishing it, allowing you to make any edits needed before releasing | ||
token: ${{ secrets.GH_ACCESS_TOKEN }} | ||
tag: "Release.${{ steps.extract_version.outputs.version }}" | ||
tag: "Release.${{ steps.prepare_for_build.outputs.version }}" | ||
artifacts: ./build/outputs/apk/*/release/*-*-release-signed.apk | ||
generateReleaseNotes: false | ||
#make_latest: true |