-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (191 loc) · 6.59 KB
/
release.yml
File metadata and controls
227 lines (191 loc) · 6.59 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
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
name: Release
on:
push:
tags:
- 'v*'
env:
FLUTTER_VERSION: '3.38.5'
jobs:
version:
name: Extract version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
build_number: ${{ steps.version.outputs.build_number }}
steps:
- name: Extract version from tag
id: version
run: |
TAG=${GITHUB_REF#refs/tags/v}
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "build_number=${{ github.run_number }}" >> $GITHUB_OUTPUT
build-android:
name: Build Android
needs: version
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Create .dart_defines
run: echo '{"SUPABASE_URL":"${{ secrets.SUPABASE_URL }}","SUPABASE_ANON_KEY":"${{ secrets.SUPABASE_ANON_KEY }}"}' > .dart_defines
- name: Install dependencies
run: flutter pub get
- name: Build APK
run: |
flutter build apk --release \
--dart-define-from-file=.dart_defines \
--build-name=${{ needs.version.outputs.version }} \
--build-number=${{ needs.version.outputs.build_number }}
- name: Rename APK
run: |
mv build/app/outputs/flutter-apk/app-release.apk \
papyrus-android-v${{ needs.version.outputs.version }}.apk
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: android-release
path: client/papyrus-android-v${{ needs.version.outputs.version }}.apk
build-web:
name: Build Web
needs: version
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Create .dart_defines
run: echo '{"SUPABASE_URL":"${{ secrets.SUPABASE_URL }}","SUPABASE_ANON_KEY":"${{ secrets.SUPABASE_ANON_KEY }}"}' > .dart_defines
- name: Install dependencies
run: flutter pub get
- name: Build web
run: |
flutter build web --release \
--dart-define-from-file=.dart_defines \
--build-name=${{ needs.version.outputs.version }} \
--build-number=${{ needs.version.outputs.build_number }}
- name: Create archive
run: |
cd build/web
zip -r ../../papyrus-web-v${{ needs.version.outputs.version }}.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: web-release
path: client/papyrus-web-v${{ needs.version.outputs.version }}.zip
build-linux:
name: Build Linux
needs: version
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Create .dart_defines
run: echo '{"SUPABASE_URL":"${{ secrets.SUPABASE_URL }}","SUPABASE_ANON_KEY":"${{ secrets.SUPABASE_ANON_KEY }}"}' > .dart_defines
- name: Install dependencies
run: flutter pub get
- name: Build Linux
run: |
flutter build linux --release \
--dart-define-from-file=.dart_defines \
--build-name=${{ needs.version.outputs.version }} \
--build-number=${{ needs.version.outputs.build_number }}
- name: Create archive
run: |
cd build/linux/x64/release/bundle
tar -czvf ../../../../../papyrus-linux-v${{ needs.version.outputs.version }}.tar.gz .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-release
path: client/papyrus-linux-v${{ needs.version.outputs.version }}.tar.gz
build-windows:
name: Build Windows
needs: version
runs-on: windows-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Create .dart_defines
run: echo '{"SUPABASE_URL":"${{ secrets.SUPABASE_URL }}","SUPABASE_ANON_KEY":"${{ secrets.SUPABASE_ANON_KEY }}"}' > .dart_defines
- name: Install dependencies
run: flutter pub get
- name: Build Windows
run: |
flutter build windows --release `
--dart-define-from-file=.dart_defines `
--build-name=${{ needs.version.outputs.version }} `
--build-number=${{ needs.version.outputs.build_number }}
- name: Create archive
run: |
Compress-Archive -Path build\windows\x64\runner\Release\* -DestinationPath papyrus-windows-v${{ needs.version.outputs.version }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-release
path: client/papyrus-windows-v${{ needs.version.outputs.version }}.zip
release:
name: Create GitHub Release
needs: [version, build-android, build-web, build-linux, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: Papyrus v${{ needs.version.outputs.version }}
generate_release_notes: true
files: |
artifacts/android-release/*
artifacts/web-release/*
artifacts/linux-release/*
artifacts/windows-release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}