-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (238 loc) · 8.63 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# 发布发行版
name: publish release
on:
push:
# 与 refs/tags 匹配的模式序列
tags:
- 'v*'
if: startsWith(github.ref, 'refs/tags')
workflow_dispatch:
env:
FLUTTER_VERSION: "3.27.2"
jobs:
# Android
build_apk:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# 创建 key.properties 和 keystore.jks
- name: Create key.properties and keystore.jks file
env:
KEY: ${{ secrets.ANDROID_KEY_PROPERTIES }}
STORE: ${{ secrets.ANDROID_KEY_STORE }}
run: |
echo $KEY | base64 -di > ./android/key.properties
echo $STORE | base64 -di > ./android/keystore.jks
- name: Set up JDK 20
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '20'
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Build APK
run: |
flutter build apk --release
flutter build apk --release --split-per-abi
flutter build appbundle --release
mkdir App
cp ./build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ./App/Glidea-${{ github.ref_name }}-android-arm32v7.apk
cp ./build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ./App/Glidea-${{ github.ref_name }}-android-arm64v8.apk
cp ./build/app/outputs/flutter-apk/app-x86_64-release.apk ./App/Glidea-${{ github.ref_name }}-android-x64.apk
cp ./build/app/outputs/flutter-apk/app-release.apk ./App/Glidea-${{ github.ref_name }}-android.apk
cp ./build/app/outputs/bundle/release/app-release.aab ./App/Glidea-${{ github.ref_name }}-android.aab
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: apk-result
path: ./App/*
# Windows
build_windows:
runs-on: windows-latest
env:
INNO_PATH: "./windows/packaging/exe/inno-setup.iss"
APP_FOLDER: "P:[/\\\\]Root[/\\\\]Project[/\\\\]app[/\\\\]glidea[/\\\\]glidea"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update inno setup
run: |
echo "(Get-Content ${{ env.INNO_PATH }}) | ForEach-Object { $_ -replace '${{ env.APP_FOLDER }}', '${{ github.workspace }}' } | Set-Content ${{ env.INNO_PATH }}"
(Get-Content ${{ env.INNO_PATH }}) | ForEach-Object { $_ -replace '${{ env.APP_FOLDER }}', '${{ github.workspace }}' } | Set-Content ${{ env.INNO_PATH }}
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Compile for Windows
run: flutter build windows
- name: Add DLL files
run: |
Copy-Item ./windows/packaging/lib/msvcp140.dll ./build/windows/x64/runner/Release/
Copy-Item ./windows/packaging/lib/vcruntime140.dll ./build/windows/x64/runner/Release/
Copy-Item ./windows/packaging/lib/vcruntime140_1.dll ./build/windows/x64/runner/Release/
- name: Zip compiled files
run: |
mkdir App, dist
Compress-Archive -Path ./build/windows/x64/runner/Release/* -DestinationPath ./App/Glidea-${{ github.ref_name }}-windows.zip
- name: Compile .ISS to .EXE Installer
uses: Minionguyjpro/Inno-Setup-Action@v1.2.2
with:
path: ${{ env.INNO_PATH }}
- name: Copy and rename exe file
run: |
ls ${{ github.workspace }}/dist
cp dist/Glidea.exe App/Glidea-${{ github.ref_name }}-windows.exe
- name: Enable flutter_distributor
run: |
dart pub global activate flutter_distributor
setx "Path" "%Path%;${{ env.PUB_CACHE }}\bin;" /m
- name: Build msix package
run: |
flutter_distributor package --platform windows --targets msix
cp dist/*/*glidea*.msix App/Glidea-${{ github.ref_name }}-windows.msix
- name: Upload Windows zip
uses: actions/upload-artifact@v4
with:
name: windows-result
path: ./App/*
# Linux_x64
build_linux-x86_64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev libfuse2
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Compile for Linux
run: flutter build linux
- name: Create tar.gz archive
run: |
mkdir App
cd ./build/linux/x64/release/bundle
tar -czvf ../../../../../App/Glidea-${{ github.ref_name }}-linux-x86-64.tar.gz *
cd ../../../../../
- name: Enable flutter_distributor
run: |
dart pub global activate flutter_distributor
echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.bashrc
- name: Build deb package
run: flutter_distributor package --platform linux --targets deb
- name: Copy file
run: cp dist/*/*glidea*.deb App/Glidea-${{ github.ref_name }}-linux-x86-64.deb
- name: Upload tar.gz archive
uses: actions/upload-artifact@v4
with:
name: linux-x86-64-result
path: ./App/*
# Linux_arm64
build_linux_arm_64:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev libfuse2
git config --global --add safe.directory /opt/hostedtoolcache/flutter/--
- uses: subosito/flutter-action@v2
with:
cache: true
channel: master
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Dependencies
run: flutter pub get
- name: Build Json
run: dart run build_runner build
- name: Compile for Linux
run: flutter build linux
- name: Create tar.gz archive
run: |
mkdir App
cd ./build/linux/arm64/release/bundle
tar -czvf ../../../../../App/Glidea-${{ github.ref_name }}-linux-arm-64.tar.gz *
cd ../../../../../
- name: Enable flutter_distributor
run: |
dart pub global activate flutter_distributor
echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.bashrc
- name: Build deb package
run: flutter_distributor package --platform linux --targets deb
- name: Copy file
run: cp dist/*/*glidea*.deb App/Glidea-${{ github.ref_name }}-linux-arm-64.deb
- name: Upload tar.gz archive
uses: actions/upload-artifact@v4
with:
name: linux-arm-64-result
path: ./App/*
# 发行
release:
needs:
- build_apk
- build_windows
- build_linux-x86_64
- build_linux_arm_64
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Draft release
id: draft_release
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download apk files
uses: actions/download-artifact@v4
with:
name: apk-result
path: ./release/
- name: Download windows files
uses: actions/download-artifact@v4
with:
name: windows-result
path: ./release/
- name: Download linux-x86-64 files
uses: actions/download-artifact@v4
with:
name: linux-x86-64-result
path: ./release/
- name: Download linux-arm-64 files
uses: actions/download-artifact@v4
with:
name: linux-arm-64-result
path: ./release/
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: ./release/*
body_path: ./CHANGELOG.md
name: ${{ steps.draft_release.outputs.name }}
tag_name: ${{ steps.draft_release.outputs.tag_name }}
append_body: ${{ steps.draft_release.outputs.body }}