Build Release #21
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 Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
permissions: | |
contents: write | |
jobs: | |
Build: | |
name: Release APK | |
runs-on: ubuntu-latest | |
steps: | |
# https://github.com/marketplace/actions/checkout | |
- uses: actions/checkout@v4 | |
# 设置 JDK | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Get Tag | |
id: var | |
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Build APK | |
run: bash ./gradlew assembleRelease | |
- name: Get Build Tool Version | |
shell: bash | |
run: | | |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) | |
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV | |
echo Last build tool version is: $BUILD_TOOL_VERSION | |
# https://github.com/marketplace/actions/sign-android-release | |
- name: Sign APK | |
id: sign_apk | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} | |
# https://github.com/marketplace/actions/auto-changelog | |
# require commit format are "type(category): description [flag]" | |
- name: Make Changelog | |
uses: ardalanamini/auto-changelog@v4.0.1 | |
id : changelog | |
with: | |
github-token : ${{ github.token }} | |
commit-types : | | |
feat: New Features | |
fix: Bug Fixes | |
build: Build System & Dependencies | |
perf: Performance Improvements | |
docs: Documentation | |
test: Tests | |
refactor: Refactors | |
chore: Chores | |
ci: CI | |
style: Code Style | |
revert: Reverts | |
default-commit-type : Other Changes | |
mention-authors : true | |
mention-new-contributors: true | |
include-compare-link : true | |
# https://github.com/marketplace/actions/gh-release | |
- name: Release APK | |
uses: softprops/action-gh-release@v2.0.5 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
token: ${{ github.token }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
prerelease: false | |
files: ${{steps.sign_apk.outputs.signedReleaseFile}} |