2
2
workflow_dispatch :
3
3
4
4
jobs :
5
- linux :
6
- runs-on : ubuntu-latest
5
+ build :
6
+ name : Build and Release
7
+ runs-on : ${{ matrix.os }}
8
+ strategy :
9
+ fail-fast : false
10
+ matrix :
11
+ os : [ubuntu-latest, macos-latest, windows-latest]
12
+
7
13
steps :
8
14
- name : Clone repository
9
15
uses : actions/checkout@v4
@@ -14,164 +20,112 @@ jobs:
14
20
channel : stable
15
21
cache : true
16
22
17
- - run : |
23
+ - if : startsWith(matrix.os, 'ubuntu')
24
+ run : |
18
25
sudo apt-get update -y
19
-
20
- - run : |
21
26
sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev mpv
22
27
23
28
- name : Install Dependencies
24
29
run : flutter pub get
25
30
26
- - name : Build linux
31
+ # Building
32
+ - if : startsWith(matrix.os, 'ubuntu')
33
+ name : Build linux
27
34
run : flutter build linux --release
28
35
29
- - name : Build APK
36
+ - if : startsWith(matrix.os, 'ubuntu')
37
+ name : Build APK
30
38
run : flutter build apk --release
31
39
32
- - name : Build appBundle
40
+ - if : startsWith(matrix.os, 'ubuntu')
41
+ name : Build appBundle
33
42
run : flutter build appbundle --release
34
43
35
- - name : Build web
44
+ - if : startsWith(matrix.os, 'ubuntu')
45
+ name : Build web
36
46
run : flutter build web --release
37
47
38
- - name : Compress Archives
48
+ - if : startsWith(matrix.os, 'macos')
49
+ name : Build MacOS
50
+ run : flutter build macos --release
51
+
52
+ # - if: startsWith(matrix.os, 'macos')
53
+ # name: Build MacOS
54
+ # run: flutter build ios --release --no-codesign
55
+
56
+ - if : startsWith(matrix.os, 'windows')
57
+ name : Build Windows
58
+ run : flutter build windows --release
59
+ # End Building
60
+
61
+ # Compressing
62
+ - if : startsWith(matrix.os, 'ubuntu')
63
+ name : Compress Archives
39
64
run : |
40
65
tar -czf linux_build.tar.gz -C build/linux/x64/release bundle
41
66
tar -czf web_build.tar.gz -C build web
42
67
43
- - name : Upload Artifacts
44
- uses : actions/upload-artifact@v4
45
- with :
46
- name : Releases
47
- path : |
48
- build/app/outputs/flutter-apk/app-release.apk
49
- linux_build.tar.gz
68
+ - if : startsWith(matrix.os, 'macos')
69
+ name : Compress Archives
70
+ run : |
71
+ tar -czf macos_build.tar.gz -C build macos
72
+ # tar -czf ios_build.tar.gz -C build ios
50
73
51
- - name : Extract version from pubspec.yaml
74
+ - if : startsWith(matrix.os, 'windows')
75
+ name : Compress Archives
76
+ run : |
77
+ tar -czf windows_build.tar.gz -C build windows
78
+ # End Compressing
79
+
80
+ - if : ${{ !startsWith(matrix.os, 'windows') }}
81
+ name : Extract version from pubspec.yaml
52
82
id : extract_version
53
83
run : |
54
84
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
55
85
echo "VERSION=$version" >> $GITHUB_ENV
56
86
57
- - name : Check if Tag Exists
87
+ - if : ${{ !startsWith(matrix.os, 'windows') }}
88
+ name : Check if Tag Exists
58
89
id : check_tag
59
90
run : |
60
91
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
61
92
echo "TAG_EXISTS=true" >> $GITHUB_ENV
62
93
else
63
94
echo "TAG_EXISTS=false" >> $GITHUB_ENV
64
95
fi
65
- - name : Modify Tag
66
- if : env.TAG_EXISTS == 'true'
96
+
97
+ - if : ${{ !startsWith(matrix.os, 'windows') && env.TAG_EXISTS == 'true' }}
98
+ name : Modify Tag
67
99
id : modify_tag
68
100
run : |
69
101
new_version="${{ env.VERSION }}-build-${{ github.run_number }}"
70
102
echo "VERSION=$new_version" >> $GITHUB_ENV
71
103
72
- - name : Create Release
104
+ # Creating Relases
105
+ - if : startsWith(matrix.os, 'ubuntu')
106
+ name : Create Release
73
107
uses : ncipollo/release-action@v1
74
108
with :
75
109
artifacts : " build/app/outputs/flutter-apk/app-release.apk,build/app/outputs/bundle/release/app-release.aab,linux_build.tar.gz"
76
110
tag : v${{ env.VERSION }}
77
111
token : ${{ secrets.TOKEN }}
112
+ allowUpdates : true
78
113
79
- macos :
80
- runs-on : macos-latest
81
- steps :
82
- - name : Clone repository
83
- uses : actions/checkout@v4
84
-
85
- - name : Set up Flutter
86
- uses : subosito/flutter-action@v2
87
- with :
88
- channel : stable
89
- cache : true
90
-
91
- - name : Install Dependencies
92
- run : flutter pub get
93
-
94
- - name : Build MacOS
95
- run : flutter build macos --release
96
-
97
- - name : Build APK
98
- run : flutter build ios --release --no-codesign
99
-
100
- - name : Compress Archives and IPAs
101
- run : |
102
- tar -czf macos_build.tar.gz -C build macos
103
- tar -czf ios_build.tar.gz -C build ios
104
-
105
-
106
- - name : Upload Artifacts
107
- uses : actions/upload-artifact@v4
108
- with :
109
- name : Releases
110
- path : |
111
- macos_build.tar.gz
112
- ios_build.tar.gz
113
-
114
- - name : Extract version from pubspec.yaml
115
- id : extract_version
116
- run : |
117
- version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
118
- echo "VERSION=$version" >> $GITHUB_ENV
119
-
120
- - name : Check if Tag Exists
121
- id : check_tag
122
- run : |
123
- if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
124
- echo "TAG_EXISTS=true" >> $GITHUB_ENV
125
- else
126
- echo "TAG_EXISTS=false" >> $GITHUB_ENV
127
- fi
128
- - name : Modify Tag
129
- if : env.TAG_EXISTS == 'true'
130
- id : modify_tag
131
- run : |
132
- new_version="${{ env.VERSION }}-build-${{ github.run_number }}"
133
- echo "VERSION=$new_version" >> $GITHUB_ENV
134
-
135
- - name : Create Release
114
+ - if : startsWith(matrix.os, 'macos')
115
+ name : Create Release
136
116
uses : ncipollo/release-action@v1
137
117
with :
138
118
artifacts : " macos_build.tar.gz,ios_build.tar.gz"
139
119
tag : v${{ env.VERSION }}
140
120
token : ${{ secrets.TOKEN }}
121
+ allowUpdates : true
141
122
142
- windows :
143
- runs-on : windows-latest
144
- steps :
145
- - name : Clone repository
146
- uses : actions/checkout@v4
147
-
148
- - name : Set up Flutter
149
- uses : subosito/flutter-action@v2
150
- with :
151
- channel : stable
152
- cache : true
153
-
154
- - name : Install Dependencies
155
- run : flutter pub get
156
-
157
- - name : Build Windows
158
- run : flutter build windows --release
159
-
160
- - name : Compress Archives and IPAs
161
- run : |
162
- tar -czf windows_build.tar.gz -C build windows
163
-
164
-
165
- - name : Upload Artifacts
166
- uses : actions/upload-artifact@v4
167
- with :
168
- name : Releases
169
- path : |
170
- windows_build.tar.gz
171
-
172
- - name : Create Release
123
+ - if : startsWith(matrix.os, 'windows')
124
+ name : Create Release
173
125
uses : ncipollo/release-action@v1
174
126
with :
175
127
artifacts : " windows_build.tar.gz"
176
- tag : ${{ github.run_number }}
177
- token : ${{ secrets.TOKEN }}
128
+ tag : v0.0.1+1
129
+ token : ${{ secrets.TOKEN }}
130
+ allowUpdates : true
131
+ # End Creating Relases
0 commit comments