build: Release 3.2.0. #70
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
name: Build | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build-job: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: zulu | |
- name: Decode Keystore | |
id: decode_keystore | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'release_keystore.jks' | |
encodedString: ${{ secrets.KEYSTORE }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build apk | |
run: | | |
if [ ! -f "gradlew" ]; then gradle wrapper; fi | |
chmod +x gradlew | |
./gradlew assembleRelease --stacktrace | |
env: | |
SIGNING_KEYSTORE_PATH: ${{ steps.decode_keystore.outputs.filePath }} | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
- name: Set ENV | |
id: vars | |
run: | | |
echo TAG=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT | |
echo HASH=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_OUTPUT | |
- name: Set Version Suffix | |
uses: haya14busa/action-cond@v1 | |
id: suffix | |
with: | |
cond: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
if_true: ${{ steps.vars.outputs.TAG }} | |
if_false: ${{ steps.vars.outputs.TAG }}-${{ steps.vars.outputs.HASH }} | |
- name: Upload artifact | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: QuoteLockX-${{ steps.suffix.outputs.value }} | |
path: ./app/build/outputs/apk/release/QuoteLockX-*.apk | |
- name: Publish | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ./app/build/outputs/apk/release/QuoteLockX-*.apk | |
token: ${{ secrets.RELEASE_GITHUB_TOKEN}} | |
body: Released by [Github Actions](https://github.com/Yubyf/QuoteLockX/actions) |