-
Notifications
You must be signed in to change notification settings - Fork 20
246 lines (211 loc) · 7.84 KB
/
release-all-platforms.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
name: Release All Platforms
on:
workflow_dispatch:
# inputs:
# tag:
# description: 'Enter a tag for this release'
# required: true
# type: string
# Release_note:
# description: 'Enter your release notes'
# required: true
# type: string
jobs:
version:
runs-on: windows-latest
permissions:
contents: read
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/[email protected]
- name: Extract Version from pubspec.yaml
id: extract_version
run: |
$VERSION = Select-String -Path ".\pubspec.yaml" -Pattern "version: (\d+\.\d+\.\d+)" -CaseSensitive | ForEach-Object{ $_.Matches.Groups[1].Value }
echo version=$VERSION >> $env:GITHUB_OUTPUT
Build-windows:
runs-on: windows-latest
permissions:
contents: read
needs: version
steps:
- uses: actions/[email protected]
- name: Install flutter
uses: subosito/[email protected]
with:
flutter-version: "3.22.0"
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
architecture: x64
- name: Install project dependencies
run: |
flutter pub get
dart pub global activate flutter_distributor
- name: Generate intermediates
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Set proper icon path
run: |
$iconPath = "${{ github.workspace }}\\assets\\icons\\logo.ico"
(Get-Content windows/packaging/exe/make_config.yaml) -replace 'PLACEHOLDER_ICON_PATH', $iconPath | Set-Content windows/packaging/exe/make_config.yaml
- name: Enable windows build
run: flutter config --enable-windows-desktop
- name: Build artifacts
run: flutter_distributor package --platform windows --targets exe
- name: change name of .exe
run: Get-ChildItem -Recurse -Path .\dist\ -Filter "*.exe" -File | Move-Item -Destination .\Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe
- name: Upload artifact
uses: actions/[email protected]
with:
name: brisk-windows
path: Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe
retention-days: 1
Build-linux:
runs-on: ubuntu-latest
permissions:
contents: read
needs: version
steps:
- name: Checkout the code
uses: actions/[email protected]
- name: Install flutter
uses: subosito/[email protected]
with:
flutter-version: "3.22.0"
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
architecture: x64
- name: Install required tools
run: |
sudo apt-get update -y
sudo apt-get install -y keybinder-3.0 clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev rpm patchelf libayatana-appindicator3-dev
- name: Enable linux-desktop for flutter
run: flutter config --enable-linux-desktop && export PATH="$PATH":"$HOME/.pub-cache/bin"
- name: Get dependencies
run: flutter pub get
- name: Start the build process
run: flutter build linux
- name: Compress the release file
run: tar -cJf Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.tar.xz -C build/linux/x64/release/bundle/ .
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
- name: Start the build process
run: flutter_distributor release --name=prod
- name: move the packages
run: find ./dist -name brisk* -execdir mv {} ../../ \;
- name: change the deb name
run: find ./ -name *.deb -execdir mv {} Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.deb \;
- name: change the rpm name
run: find ./ -name *.rpm -execdir mv {} Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.rpm \;
- name: Upload artifact
uses: actions/[email protected]
with:
name: brisk-package
path: ./Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.*
retention-days: 1
# Build-macos:
# runs-on: macos-latest
# permissions:
# contents: read
# needs: version
# steps:
#
# - name: Checkout the code
# uses: actions/[email protected]
#
# - name: Set up Node.js
# uses: actions/setup-node@v3
# with:
# node-version: '20'
#
# - name: Install npm dependencies
# run: npm install -g appdmg
#
# - name: Install flutter
# uses: subosito/[email protected]
# with:
# flutter-version: "3.22.0"
# channel: 'stable'
# cache: true
# cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
# cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
#
# - name: Enable linux-desktop for flutter
# run: flutter config --enable-macos-desktop && export PATH="$PATH":"$HOME/.pub-cache/bin"
#
# - name: Copy MacOS related files
# run: |
# cp macos/Runner/Release.entitlements .
# cp -r macos/Runner/Assets.xcassets .
# cp -r macos/packaging .
#
# - name: Recreate MacOS directory
# run: |
# rm -rf macos
# flutter create --platform macos .
#
# - name: Replace MacOS files
# run: |
# mv packaging macos/
# cp -f Release.entitlements macos/Runner/
# cp -rf Assets.xcassets macos/Runner/
#
# - name: Get dependencies
# run: flutter pub get
#
# - name: Install flutter_distributor
# run: dart pub global activate flutter_distributor
#
# - name: Start the build process
# run: flutter_distributor package --platform macos --targets dmg
#
# - name: Debug
# run: ls dist/${{ needs.version.outputs.version }}
#
# - name: Rename dmg File
# run: mv dist/${{ needs.version.outputs.version }}/brisk-${{ needs.version.outputs.version }}+${{ needs.version.outputs.version }}-macos.dmg ./Brisk-${{ needs.version.outputs.version }}-macos-x64.dmg
#
# - name: Upload artifact
# uses: actions/[email protected]
# with:
# name: brisk-dmg
# path: Brisk-${{ needs.version.outputs.version }}-macos-x64.dmg
# retention-days: 1
Release:
runs-on: ubuntu-latest
# needs: [Build-Linux, Build-windows, Build-macos, version]
needs: [Build-Linux, Build-windows, version]
permissions:
contents: write
steps:
- name: Checkout the code
uses: actions/[email protected]
- name: Download linux artifact
uses: actions/[email protected]
with:
name: brisk-package
- name: Download windows package
uses: actions/[email protected]
with:
name: brisk-windows
# - name: Download macos package
# uses: actions/[email protected]
# with:
# name: brisk-dmg
- name: Release the changes
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.version.outputs.version }}
body_path: ./.github/release.md
files: |
./Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.rpm
./Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.deb
./Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.tar.xz
./Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe
# ./Brisk-${{ needs.version.outputs.version }}-macos-x64.dmg