2023-10-22 10:57:35 +03:00
|
|
|
name: Build Release
|
2023-05-10 13:10:50 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '*' #
|
2023-05-10 20:48:59 +03:00
|
|
|
workflow_dispatch:
|
2023-10-22 10:57:35 +03:00
|
|
|
inputs:
|
|
|
|
auto-bump-version:
|
|
|
|
description: 'Auto bump project version before building release'
|
|
|
|
required: false
|
|
|
|
type: boolean
|
2023-05-10 13:10:50 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
BuildRelease:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Repository
|
|
|
|
uses: actions/checkout@v3
|
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
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
distribution: 'zulu'
|
|
|
|
java-version: 17
|
|
|
|
|
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: "1.20"
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
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
|
|
|
|
|
|
|
# If auto-bump-version is chosen BEGIN
|
|
|
|
- name: Configure Git
|
|
|
|
if: ${{ inputs.auto-bump-version }}
|
|
|
|
run: |
|
|
|
|
git config --global user.name 'GitHub Action'
|
|
|
|
git config --global user.email 'action@github.com'
|
|
|
|
|
|
|
|
- name: Auto bump project version
|
|
|
|
if: ${{ inputs.auto-bump-version }}
|
|
|
|
id: bump-version
|
|
|
|
run: |
|
|
|
|
versionCode=$(grep -oP 'versionCode = \K\d+' build.gradle.kts)
|
|
|
|
versionName=$(grep -oP 'versionName = "\K[0-9.]+' build.gradle.kts)
|
|
|
|
major=$(echo $versionName | cut -d. -f1)
|
|
|
|
minor=$(echo $versionName | cut -d. -f2)
|
|
|
|
patch=$(echo $versionName | cut -d. -f3)
|
|
|
|
newPatch=$((patch + 1))
|
|
|
|
newVersionName="$major.$minor.$newPatch"
|
|
|
|
newVersionCode=$((versionCode + 1))
|
|
|
|
sed -i "s/versionCode = $versionCode/versionCode = $newVersionCode/" build.gradle.kts
|
|
|
|
sed -i "s/versionName = \"$versionName\"/versionName = \"$newVersionName\"/" build.gradle.kts
|
|
|
|
echo "::set-output name=newVersionName::$newVersionName"
|
|
|
|
echo "::set-output name=newVersionCode::$newVersionCode"
|
|
|
|
|
|
|
|
- name: Commit modified version code and make new tag
|
|
|
|
if: ${{ inputs.auto-bump-version }}
|
|
|
|
run: |
|
|
|
|
newVersionName=${{ steps.bump-version.outputs.newVersionName }}
|
|
|
|
newVersionCode=${{ steps.bump-version.outputs.newVersionCode }}
|
|
|
|
git commit -am "Bump version to $newVersionName ($newVersionCode)"
|
|
|
|
git tag "v$newVersionName"
|
|
|
|
git push --follow-tags
|
|
|
|
# If auto-bump-version is chosen END
|
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
|
2023-10-22 10:57:35 +03:00
|
|
|
|
|
|
|
- name: Get real tag value (current or auto-bumped?)
|
|
|
|
id: real_tag
|
|
|
|
run: |
|
|
|
|
if [[ "${{ inputs.auto-bump-version }}" == "true" ]]; then
|
|
|
|
echo "::set-output name=tag::v${{ steps.bump-version.outputs.newVersionName }}"
|
|
|
|
else
|
2023-10-22 13:19:57 +03:00
|
|
|
echo "::set-output name=tag::$(git describe --tags --abbrev=0)"
|
2023-10-22 10:57:35 +03:00
|
|
|
fi
|
2023-05-10 13:10:50 +03:00
|
|
|
|
|
|
|
- name: Tag Repo
|
|
|
|
uses: richardsimko/update-tag@v1
|
|
|
|
with:
|
2023-10-22 10:57:35 +03:00
|
|
|
tag_name: ${{ steps.real_tag.outputs.tag }}
|
2023-05-10 13:10:50 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Upload Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: ${{ success() }}
|
|
|
|
with:
|
2023-10-22 16:31:17 +03:00
|
|
|
tag_name: ${{ steps.real_tag.outputs.tag }}
|
2023-05-10 13:10:50 +03:00
|
|
|
files: app/build/outputs/apk/meta/release/*
|
|
|
|
generate_release_notes: true
|
|
|
|
|
|
|
|
- name: Release Changelog Builder
|
|
|
|
uses: mikepenz/release-changelog-builder-action@v3.6.0
|