Skip to content

Commit 09e4368

Browse files
committed
update workflow
1 parent 0fe389b commit 09e4368

File tree

1 file changed

+66
-112
lines changed

1 file changed

+66
-112
lines changed

.github/workflows/main.yml

Lines changed: 66 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ on:
22
workflow_dispatch:
33

44
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+
713
steps:
814
- name: Clone repository
915
uses: actions/checkout@v4
@@ -14,164 +20,112 @@ jobs:
1420
channel: stable
1521
cache: true
1622

17-
- run: |
23+
- if: startsWith(matrix.os, 'ubuntu')
24+
run: |
1825
sudo apt-get update -y
19-
20-
- run: |
2126
sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev mpv
2227
2328
- name: Install Dependencies
2429
run: flutter pub get
2530

26-
- name: Build linux
31+
# Building
32+
- if: startsWith(matrix.os, 'ubuntu')
33+
name: Build linux
2734
run: flutter build linux --release
2835

29-
- name: Build APK
36+
- if: startsWith(matrix.os, 'ubuntu')
37+
name: Build APK
3038
run: flutter build apk --release
3139

32-
- name: Build appBundle
40+
- if: startsWith(matrix.os, 'ubuntu')
41+
name: Build appBundle
3342
run: flutter build appbundle --release
3443

35-
- name: Build web
44+
- if: startsWith(matrix.os, 'ubuntu')
45+
name: Build web
3646
run: flutter build web --release
3747

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
3964
run: |
4065
tar -czf linux_build.tar.gz -C build/linux/x64/release bundle
4166
tar -czf web_build.tar.gz -C build web
4267
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
5073

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
5282
id: extract_version
5383
run: |
5484
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
5585
echo "VERSION=$version" >> $GITHUB_ENV
5686
57-
- name: Check if Tag Exists
87+
- if: ${{ !startsWith(matrix.os, 'windows') }}
88+
name: Check if Tag Exists
5889
id: check_tag
5990
run: |
6091
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
6192
echo "TAG_EXISTS=true" >> $GITHUB_ENV
6293
else
6394
echo "TAG_EXISTS=false" >> $GITHUB_ENV
6495
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
6799
id: modify_tag
68100
run: |
69101
new_version="${{ env.VERSION }}-build-${{ github.run_number }}"
70102
echo "VERSION=$new_version" >> $GITHUB_ENV
71103
72-
- name: Create Release
104+
# Creating Relases
105+
- if: startsWith(matrix.os, 'ubuntu')
106+
name: Create Release
73107
uses: ncipollo/release-action@v1
74108
with:
75109
artifacts: "build/app/outputs/flutter-apk/app-release.apk,build/app/outputs/bundle/release/app-release.aab,linux_build.tar.gz"
76110
tag: v${{ env.VERSION }}
77111
token: ${{ secrets.TOKEN }}
112+
allowUpdates: true
78113

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
136116
uses: ncipollo/release-action@v1
137117
with:
138118
artifacts: "macos_build.tar.gz,ios_build.tar.gz"
139119
tag: v${{ env.VERSION }}
140120
token: ${{ secrets.TOKEN }}
121+
allowUpdates: true
141122

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
173125
uses: ncipollo/release-action@v1
174126
with:
175127
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

Comments
 (0)