-
Notifications
You must be signed in to change notification settings - Fork 132
119 lines (115 loc) · 4.04 KB
/
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Generated APK AAB (Upload - Create Artifact To Github Action)
env:
# The name of the main module repository
main_project_module: app
RELEASE_VERSION: ""
on:
# on merge to master
push:
branches:
- master
paths-ignore:
- '.idea/**'
- '.gitattributes'
- '.github/**.json'
- '.gitignore'
- '.gitmodules'
- '**.md'
- 'LICENSE'
- 'NOTICE'
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Skip duplicate actions
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: true
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
gradle-home-cache-cleanup: true
# - run: ./gradlew spotlessCheck
build:
runs-on: ubuntu-latest
steps:
- name: Skip duplicate actions
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: true
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
gradle-home-cache-cleanup: true
- name: Retrieve version
run: |
echo VERSION=$(echo ${{ github.event.head_commit.id }} | head -c 10) >> $GITHUB_ENV
# Set Repository Name As Env Variable
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
# Create APK Release
- name: Build apk release project (APK) - ${{ env.main_project_module }} module
run: ./gradlew -PappVerName=${{ env.VERSION }} ${{ env.main_project_module }}:assembleRelease
# Create Bundle AAB Release
# Noted for main module build [main_project_module]:bundleRelease
- name: Build app bundle release (AAB) - ${{ env.main_project_module }} module
run: ./gradlew ${{ env.main_project_module }}:bundleRelease
- name: Sign apk release
if: success()
id: sign_apk
uses: r0adkll/[email protected]
env:
BUILD_TOOLS_VERSION: "34.0.0"
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Sign bundle release
if: success()
id: sign_bundle
uses: r0adkll/[email protected]
env:
BUILD_TOOLS_VERSION: "34.0.0"
with:
releaseDirectory: app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Set version from properties
run: |
majorVersion=$(grep 'majorVersion=' gradle.properties | cut -d'=' -f2)
minorVersion=$(grep 'minorVersion=' gradle.properties | cut -d'=' -f2)
patchVersion=$(grep 'patchVersion=' gradle.properties | cut -d'=' -f2)
version="${majorVersion}.${minorVersion}.${patchVersion}"
echo "RELEASE_VERSION=$version" >> "$GITHUB_ENV"
- name: Publish release.
if: success()
uses: softprops/action-gh-release@v2
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
draft: true
tag_name: ${{ env.RELEASE_VERSION }}
generate_release_notes: true
files: |
app/build/outputs/apk/release/*-signed.apk
app/build/outputs/bundle/release/*.aab
app/build/outputs/mapping/release/mapping.txt