-
Notifications
You must be signed in to change notification settings - Fork 3
150 lines (125 loc) · 5.3 KB
/
deploy_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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Deploy release
on:
release:
types: [prereleased, released]
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Build APK
run: bash ./gradlew assembleOssRelease --stacktrace
- name: Build AAB
run: bash ./gradlew :app:bundlePlaystoreRelease --stacktrace -Dpurchase.validation.key=${{ secrets.PURCHASE_VALIDATION_KEY }}
- name: Setup build tool version variable
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
- uses: r0adkll/sign-android-release@v1
name: Sign app APK
id: sign_app_apk
with:
releaseDirectory: app/build/outputs/apk/oss/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 }}
- uses: r0adkll/sign-android-release@v1
name: Sign app AAB
id: sign_app_aab
with:
releaseDirectory: app/build/outputs/bundle/playstoreRelease
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 Release Asset
id: upload-release-asset-apk
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{steps.sign_app_apk.outputs.signedReleaseFile}}
asset_name: app-release.apk
asset_content_type: application/zip
- name: Choose Release track
id: get_track
run: echo TRACK=$(if [[ "${{ steps.get_release.outputs.prerelease }}" == "false" ]] ; then echo production ; else echo alpha ; fi) >> $GITHUB_OUTPUT
- name: Generate whatsnew
id: generate_whatsnew
run: |
mkdir -p google-play/whatsnew
echo "${{ steps.get_release.outputs.body }}" | sed '/^-/!d;s/- #[[:digit:]]\+ \(.*\) @\(.*\)/- \1/g' >> google-play/whatsnew/whatsnew-de-DE
echo "${{ steps.get_release.outputs.body }}" | sed '/^-/!d;s/- #[[:digit:]]\+ \(.*\) @\(.*\)/- \1/g' >> google-play/whatsnew/whatsnew-en-US
- name: Upload AAB Google Play
id: upload-release-asset-aab
uses: r0adkll/upload-google-play@v1.1.3
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT }}
packageName: com.github.frimtec.android.pikettassist
releaseFiles: ${{steps.sign_app_aab.outputs.signedReleaseFile}}
track: ${{ steps.get_track.outputs.TRACK }}
whatsNewDirectory: google-play/whatsnew
status: completed
update-repo:
runs-on: ubuntu-22.04
needs: deploy
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Checkout release/next branch
run: |
git checkout release/next
- name: Read version.properties
id: read_version_properties
run: |
while IFS='=' read -r key value; do
if [ "$key" ]; then
echo "$key=$value"
# Set as environment variable
echo "$key=$value" >> $GITHUB_OUTPUT
fi
done < app/version.properties
- name: Checkout master branch
run: |
git checkout master
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Create fastlane changelog
run: |
mkdir -p fastlane/metadata/android/en-US/changelogs
echo "${{ steps.get_release.outputs.body }}" | sed '/^-/!d;s/- #[[:digit:]]\+ \(.*\) @\(.*\)/- \1/g' | head -n 10 >> fastlane/metadata/android/en-US/changelogs/${{ steps.read_version_properties.outputs.VERSION_CODE }}.txt
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add fastlane/metadata/android/en-US/changelogs/${{ steps.read_version_properties.outputs.VERSION_CODE }}.txt
git commit -m "Update release changelog for ${{ steps.read_version_properties.outputs.VERSION_NAME }}"
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: 'master'