-
Notifications
You must be signed in to change notification settings - Fork 21
184 lines (158 loc) · 5.05 KB
/
preview_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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: preview_release
on:
push:
tags:
- "preview_*"
paths-ignore:
- '.github/**'
jobs:
build:
name: Build
runs-on: ubuntu-22.04
strategy:
matrix:
PRODUCT_VARIANT: [ ModernPreviewRelease, LegacyPreviewRelease ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Generate Sign Config
env:
SECRETS_KEY: ${{ secrets.KEY }}
SECRETS_STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
SECRETS_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
SECRETS_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEYSTORE_FILE: ${{ github.workspace }}/key.jdk
CONFIG_FILE: ${{ github.workspace }}/signing.properties
run: |
bash ${{ github.workspace }}/scripts/generate_signing_key.sh
- name: Prepare Gradlew
# just download gradle wrapper, start gradle daemon, make actual build logs clean
run: |
./gradlew clean
- name: Build with Gradle
run: |
./gradlew assemble${{ matrix.PRODUCT_VARIANT }} --stacktrace
- name: Collect Files
run: |
# collect files
mkdir products
./gradlew Publish${{ matrix.PRODUCT_VARIANT }} --stacktrace
echo "Artifacts:"
tree -aF ./products
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts_${{ matrix.PRODUCT_VARIANT }}
path: |
products/${{ matrix.PRODUCT_VARIANT }}/*.apk
products/${{ matrix.PRODUCT_VARIANT }}/*.sha*
products/${{ matrix.PRODUCT_VARIANT }}/PhonographPlus*.txt.gz
retention-days: 30
- name: Clean up
run: |
rm -r -v ./products/${{ matrix.PRODUCT_VARIANT }}
changelog:
name: Generate Changelogs
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Grant Execute Permission for Gradlew
run:
chmod +x gradlew
- name: Generate Changelog Markdown
run: |
# Prepare
./gradlew tools:changelog-generator:classes
# generate changelog
./gradlew tools:changelog-generator:GenerateGithubReleaseNote
./gradlew tools:changelog-generator:GenerateEscapedMarkdownReleaseNote
- name: Upload Changelogs
uses: actions/upload-artifact@v4
with:
name: Changelogs
path: |
GitHubReleaseNote.md
EscapedReleaseNote.md
retention-days: 1
upload:
name: Release & Upload
runs-on: ubuntu-22.04
needs:
- build
- changelog
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: products
pattern: Artifacts_*
merge-multiple: true
- name: Download Changelogs
uses: actions/download-artifact@v4
with:
pattern: Changelogs
merge-multiple: true
- name: Check Files
run: |
tree -aF ./products
ls | grep ReleaseNote
- name: Release New Version
uses: softprops/action-gh-release@v2
id: release_github
if: startsWith(github.ref, 'refs/tags/preview_')
with:
name: ${{ github.ref_name }}
files: |
products/PhonographPlus_*.apk
products/PhonographPlus_*.apk.sha1
products/PhonographPlus_*.apk.sha256
products/PhonographPlus*.txt.gz
prerelease: true
draft: false
tag_name: ${{ github.ref }}
body: Preview Release - ${{ github.ref }}
body_path: ${{ github.workspace }}/GitHubReleaseNote.md
token: ${{ secrets.TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python Pip Dependencies
if: startsWith(github.ref, 'refs/tags/preview_')
run: |
python -m pip install pyTelegramBotAPI
- name: Upload Files with Changelogs
if: startsWith(github.ref, 'refs/tags/preview_')
env:
TOKEN: ${{ secrets.TB_TOKEN }}
CHAT_ID: ${{ secrets.TG_CHANNEL_CHAT_ID }}
VERSION: ${{ github.ref_name }}
GIT_COMMIT: ${{ github.sha }}
ARTIFACTS: "products"
run: |
python ${{ github.workspace }}/scripts/upload_apk_with_changelog.py