-
Notifications
You must be signed in to change notification settings - Fork 663
99 lines (87 loc) · 2.98 KB
/
build-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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 }}
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: ${{steps.sign_apk.outputs.signedReleaseFile}}
path: ${{steps.sign_apk.outputs.signedReleaseFile}}
# https://github.com/marketplace/actions/auto-changelog
# require commit format are "type(category): description [flag]"
- name: Make Changelog
uses: ardalanamini/[email protected]
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
- name: Upload Changelog
uses: actions/upload-artifact@v4
with:
name: Changelog
path: ${{ steps.changelog.outputs.changelog }}
# https://github.com/marketplace/actions/gh-release
- name: Release APK
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ github.token }}
body: ${{ steps.changelog.outputs.changelog }}
prerelease: false
files: ${{steps.sign_apk.outputs.signedReleaseFile}}