2023-10-22 10:57:35 +03:00
|
|
|
name: Build Release
|
2023-05-10 13:10:50 +03:00
|
|
|
|
|
|
|
on:
|
2023-05-10 20:48:59 +03:00
|
|
|
workflow_dispatch:
|
2023-10-22 10:57:35 +03:00
|
|
|
inputs:
|
2023-11-02 20:53:59 +03:00
|
|
|
release-tag:
|
|
|
|
description: 'Release Tag (v2.x.x)'
|
|
|
|
required: true
|
2023-05-10 13:10:50 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
BuildRelease:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Repository
|
2024-01-18 11:52:50 +03:00
|
|
|
uses: actions/checkout@v4
|
2023-10-22 16:15:41 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-05-10 13:10:50 +03:00
|
|
|
|
|
|
|
- name: Checkout submodules
|
|
|
|
run: git submodule update --init --recursive --remote
|
|
|
|
|
|
|
|
- name: Setup Java
|
2024-01-18 11:52:50 +03:00
|
|
|
uses: actions/setup-java@v4
|
2023-05-10 13:10:50 +03:00
|
|
|
with:
|
|
|
|
distribution: 'zulu'
|
|
|
|
java-version: 17
|
|
|
|
|
|
|
|
- name: Setup Go
|
2024-01-18 11:52:50 +03:00
|
|
|
uses: actions/setup-go@v5
|
2023-05-10 13:10:50 +03:00
|
|
|
with:
|
|
|
|
go-version: "1.20"
|
|
|
|
|
2024-01-18 11:52:50 +03:00
|
|
|
- uses: actions/cache@v4
|
2023-05-10 13:10:50 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2023-10-22 10:57:35 +03:00
|
|
|
|
2023-11-02 20:53:59 +03:00
|
|
|
- name: Convert and set version env
|
|
|
|
id: process-version
|
2023-10-22 10:57:35 +03:00
|
|
|
run: |
|
2023-11-02 20:53:59 +03:00
|
|
|
VERSION_TAG=${{ inputs.release-tag }}
|
2023-11-03 05:29:19 +03:00
|
|
|
VERSION_TAG=${VERSION_TAG#v} # remove the 'v' prefix
|
2023-11-02 20:53:59 +03:00
|
|
|
IFS='.' read -ra VERSION_PARTS <<< "$VERSION_TAG" # split into array
|
|
|
|
VERSION_CODE=$(printf "%1d%02d%03d" "${VERSION_PARTS[0]}" "${VERSION_PARTS[1]}" "${VERSION_PARTS[2]}")
|
|
|
|
|
2023-11-03 05:29:19 +03:00
|
|
|
echo "versonName=$VERSION_TAG" >> $GITHUB_OUTPUT # "1.2.3"
|
|
|
|
echo "versonCode=$VERSION_CODE" >> $GITHUB_OUTPUT # "102003"
|
2023-10-22 10:57:35 +03:00
|
|
|
|
2023-11-02 20:53:59 +03:00
|
|
|
# Re-write version in build.gradle.kts
|
|
|
|
- name: Re-write version
|
2024-01-18 11:52:50 +03:00
|
|
|
uses: Devofure/advance-android-version-actions@v1.5
|
2023-11-02 20:53:59 +03:00
|
|
|
with:
|
|
|
|
gradlePath: build.gradle.kts
|
|
|
|
versionCode: ${{ steps.process-version.outputs.versonCode }}
|
|
|
|
versionName: ${{ steps.process-version.outputs.versonName }}
|
2023-10-22 10:57:35 +03:00
|
|
|
|
2023-11-02 20:53:59 +03:00
|
|
|
# If any change found, commit it and push
|
|
|
|
- name: Commit and push if changes
|
2023-10-22 10:57:35 +03:00
|
|
|
run: |
|
2023-11-02 20:53:59 +03:00
|
|
|
changes=$(git diff --name-only origin/main | wc -l)
|
|
|
|
if [ $changes -gt 0 ]
|
|
|
|
then
|
|
|
|
newVersionName=${{ steps.process-version.outputs.versonName }}
|
|
|
|
newVersionCode=${{ steps.process-version.outputs.versonCode }}
|
|
|
|
git config --global user.name 'GitHub Action'
|
|
|
|
git config --global user.email 'action@github.com'
|
|
|
|
git add build.gradle.kts
|
|
|
|
git commit -am "Bump version to $newVersionName ($newVersionCode)"
|
|
|
|
git tag "v$newVersionName"
|
|
|
|
git push --follow-tags
|
|
|
|
fi
|
2023-05-10 13:10:50 +03:00
|
|
|
|
|
|
|
- name: Signing properties
|
|
|
|
env:
|
|
|
|
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
|
|
|
|
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
|
|
|
|
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
touch signing.properties
|
|
|
|
echo keystore.password="$SIGNING_STORE_PASSWORD" > signing.properties
|
|
|
|
echo key.alias="$SIGNING_KEY_ALIAS" >> signing.properties
|
|
|
|
echo key.password="$SIGNING_KEY_PASSWORD" >> signing.properties
|
|
|
|
|
|
|
|
echo "cat signing.properties"
|
|
|
|
cat signing.properties
|
|
|
|
|
|
|
|
- name: Release Build
|
|
|
|
if: success()
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
with:
|
|
|
|
arguments: --no-daemon app:assembleMetaRelease
|
|
|
|
|
|
|
|
- name: Tag Repo
|
|
|
|
uses: richardsimko/update-tag@v1
|
|
|
|
with:
|
2023-11-03 05:29:19 +03:00
|
|
|
tag_name: ${{ inputs.release-tag }}
|
2023-05-10 13:10:50 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Upload Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
2023-10-22 11:56:10 +03:00
|
|
|
if: ${{ success() }}
|
2023-05-10 13:10:50 +03:00
|
|
|
with:
|
2023-11-03 05:29:19 +03:00
|
|
|
tag_name: ${{ inputs.release-tag }}
|
2023-05-10 13:10:50 +03:00
|
|
|
files: app/build/outputs/apk/meta/release/*
|
|
|
|
generate_release_notes: true
|
|
|
|
|
|
|
|
- name: Release Changelog Builder
|
2024-01-18 11:52:50 +03:00
|
|
|
uses: mikepenz/release-changelog-builder-action@v4.1.1
|
2023-11-02 20:53:59 +03:00
|
|
|
with:
|
|
|
|
configurationJson: |
|
|
|
|
{
|
|
|
|
"ignore_labels": [
|
|
|
|
"Update"
|
|
|
|
],
|
|
|
|
}
|