-
-
Notifications
You must be signed in to change notification settings - Fork 500
199 lines (193 loc) · 6.73 KB
/
Copy pathbuild.yml
File metadata and controls
199 lines (193 loc) · 6.73 KB
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
name: Flutter Build
on:
workflow_dispatch:
inputs:
release:
description: 'Create GitHub Release (auto tag v1.0.<commit_count>)'
required: false
type: boolean
default: false
push:
tags:
- "v*"
permissions:
contents: write
env:
APP_NAME: ServerBox
BUILD_TAG: test-build-${{ github.run_number }}-${{ github.sha }}
jobs:
buildAndroid:
name: Build android
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
fetch-depth: 0
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.44.1"
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "21"
- name: Fetch secrets
run: |
curl --fail --show-error --location -u ${{ secrets.BASIC_AUTH }} -o android/app/app.key ${{ secrets.URL_PREFIX }}app.key
curl --fail --show-error --location -u ${{ secrets.BASIC_AUTH }} -o android/key.properties ${{ secrets.URL_PREFIX }}key.properties
- name: Patch JNI build-id
run: |
flutter pub get
scripts/release/patch-jni-build-id.sh
- name: Build (release)
if: inputs.release == true || github.ref_type == 'tag'
shell: bash
run: dart run fl_build -bp -p android
- name: Build (test)
if: inputs.release != true && github.ref_type != 'tag'
shell: bash
run: dart run fl_build -p android
- name: Rename
shell: bash
run: |
cd build/app/outputs/flutter-apk
for f in *_${BUILD_NUMBER}_*.apk; do
mv "$f" "${f/_${BUILD_NUMBER}_/_v1.0.${BUILD_NUMBER}_}"
done
# Remove original APKs copied by fl_build
rm -f app-*-release.apk
- name: Upload artifacts
if: inputs.release != true && github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}-${{ env.BUILD_TAG }}-android
path: build/app/outputs/flutter-apk/*.apk
if-no-files-found: error
retention-days: 14
- name: Create Release
if: inputs.release == true || github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
tag_name: v1.0.${{ env.BUILD_NUMBER }}
files: |
build/app/outputs/flutter-apk/${{ env.APP_NAME }}_v1.0.${{ env.BUILD_NUMBER }}_arm64.apk
build/app/outputs/flutter-apk/${{ env.APP_NAME }}_v1.0.${{ env.BUILD_NUMBER }}_arm.apk
build/app/outputs/flutter-apk/${{ env.APP_NAME }}_v1.0.${{ env.BUILD_NUMBER }}_amd64.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
buildLinux:
name: Build linux
strategy:
fail-fast: false
matrix:
include:
- runs_on: ubuntu-latest
release_suffix: ""
artifact_suffix: ""
- runs_on: ubuntu-22.04
release_suffix: "_legacy"
artifact_suffix: "-legacy"
runs-on: ${{ matrix.runs_on }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
fetch-depth: 0
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: "3.44.1"
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev mesa-utils libvulkan-dev desktop-file-utils wget
sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev libsecret-1-dev
- name: Build (release)
if: inputs.release == true || github.ref_type == 'tag'
shell: bash
run: dart run fl_build -bp -p linux
- name: Build (test)
if: inputs.release != true && github.ref_type != 'tag'
shell: bash
run: dart run fl_build -p linux
- name: Rename
shell: bash
run: |
for f in *_${BUILD_NUMBER}_*.AppImage; do
mv "$f" "${f/_${BUILD_NUMBER}_/_v1.0.${BUILD_NUMBER}_}"
done
- name: Add legacy suffix
if: matrix.release_suffix != ''
shell: bash
run: |
mv "${APP_NAME}_v1.0.${BUILD_NUMBER}_amd64.AppImage" "${APP_NAME}_v1.0.${BUILD_NUMBER}${{ matrix.release_suffix }}_amd64.AppImage"
- name: Upload artifacts
if: inputs.release != true && github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}-${{ env.BUILD_TAG }}-linux${{ matrix.artifact_suffix }}
path: "*.AppImage"
if-no-files-found: error
retention-days: 14
- name: Create Release
if: inputs.release == true || github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
tag_name: v1.0.${{ env.BUILD_NUMBER }}
files: |
${{ env.APP_NAME }}_v1.0.${{ env.BUILD_NUMBER }}${{ matrix.release_suffix }}_amd64.AppImage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
buildWindows:
name: Build windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
fetch-depth: 0
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: "3.44.1"
- name: Build (release)
if: inputs.release == true || github.ref_type == 'tag'
shell: bash
run: dart run fl_build -bp -p windows
- name: Build (test)
if: inputs.release != true && github.ref_type != 'tag'
shell: bash
run: dart run fl_build -p windows
- name: Rename
shell: bash
run: |
for f in *_${BUILD_NUMBER}_*.zip; do
mv "$f" "${f/_${BUILD_NUMBER}_/_v1.0.${BUILD_NUMBER}_}"
done
- name: Upload artifacts
if: inputs.release != true && github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}-${{ env.BUILD_TAG }}-windows
path: "*_windows_amd64.zip"
if-no-files-found: error
retention-days: 14
- name: Create Release
if: inputs.release == true || github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
tag_name: v1.0.${{ env.BUILD_NUMBER }}
files: |
${{ env.APP_NAME }}_v1.0.${{ env.BUILD_NUMBER }}_windows_amd64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}