-
-
Notifications
You must be signed in to change notification settings - Fork 22
223 lines (188 loc) · 6.87 KB
/
Copy pathbuild-and-deploy.yaml
File metadata and controls
223 lines (188 loc) · 6.87 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
name: Build and Deploy Releases
on:
workflow_dispatch:
inputs:
version_number:
description: 'Release Version Number'
required: true
type: string
android:
description: 'Build Android Release'
type: boolean
default: true
linux:
description: 'Build Linux Release'
type: boolean
default: true
windows:
description: 'Build Windows Release'
type: boolean
default: true
web:
description: 'Build Web Release'
type: boolean
default: true
env:
FLUTTER_CHANNEL: "stable"
RUBY_VERSION: "3.2.2"
jobs:
create_github_release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create a GitHub Release
run: |
if gh release view "${{ inputs.version_number }}" > /dev/null 2>&1; then
echo "Release '${{ inputs.version_number }}' already exists. Skipping release creation."
else
echo "Release '${{ inputs.version_number }}' does not exist. Creating release..."
gh release create "${{ inputs.version_number }}" --title "Version ${{ inputs.version_number }}" --generate-notes
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
build_web:
if: ${{ inputs.web }}
name: Build Web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Flutter tasks
uses: subosito/flutter-action@v2
with:
flutter-version-file: 'pubspec.yaml'
channel: ${{ env.FLUTTER_CHANNEL }}
- name: Generate Localizations
run: flutter gen-l10n
- uses: bluefireteam/flutter-gh-pages@v9
with:
baseHref: /Classipod/
build_linux:
if: ${{ inputs.linux }}
name: Build Linux
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Flutter tasks
uses: subosito/flutter-action@v2.16.0
with:
flutter-version-file: 'pubspec.yaml'
channel: ${{ env.FLUTTER_CHANNEL }}
architecture: x64
cache: true
- name: Install System Dependencies
run: |
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libstdc++-12-dev libasound2-dev
- name: Install Flutter Dependencies
run: flutter pub get
- name: Generate Localizations
run: flutter gen-l10n
- name: Install Fastforge
run: dart pub global activate fastforge
- name: Install Build Dependencies
run: |
sudo apt-get -y install libfuse-dev locate
wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool
chmod +x /usr/local/bin/appimagetool
sudo apt-get -y install dpkg
sudo apt-get -y install patchelf rpm
- name: Build and release
run: fastforge release --name production
- name: "Publish Linux Release"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
REL_VER=$(grep "^version" pubspec.yaml | cut -d' ' -f2)
for PKG in AppImage deb rpm; do
mv "dist/${REL_VER}/classipod-${REL_VER}-linux.${PKG}" "Classipod-Linux-${PKG}.${PKG}"
gh release upload ${{ inputs.version_number }} "Classipod-Linux-${PKG}.${PKG}" --clobber
done
build_windows:
if: ${{ inputs.windows }}
name: Build Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install yq
run: choco install yq
- name: Run Flutter tasks
uses: subosito/flutter-action@v2
with:
flutter-version-file: 'pubspec.yaml'
channel: ${{ env.FLUTTER_CHANNEL }}
- name: Generate Localizations
run: flutter gen-l10n
- name: Build Windows Release
run: flutter build windows --release
- name: Install Inno Setup
run: |
Invoke-WebRequest -Uri http://files.jrsoftware.org/is/6/innosetup-6.4.2.exe -OutFile build\installer.exe
git clone https://github.com/DomGries/InnoDependencyInstaller.git build\inno-depend
Start-Process -Wait -FilePath build\installer.exe -ArgumentList '/verysilent', '/allusers', '/dir=build\iscc'
- name: Run Inno Setup to Build Installer
run: |
build\iscc\iscc.exe scripts\windows-setup.iss /DMyAppVersion=${{ inputs.version_number }}
- name: Upload Windows Release Artifact to GitHub Release
shell: cmd
run: |
gh release upload ${{ inputs.version_number }} C:\a\Classipod\Classipod\Classipod-Windows.exe
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
build_android:
if: ${{ inputs.android }}
name: Build Android
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
working-directory: 'android'
- name: Run Flutter tasks
uses: subosito/flutter-action@v2.16.0
with:
flutter-version-file: 'pubspec.yaml'
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Create google_service_account.json
run: |
echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT_BASE64 }}" | base64 --decode > google_service_account.json
- name: Create key.jks
run: |
echo "${{ secrets.ANDROID_KEYSTORE_FILE_BASE64 }}" | base64 --decode > android/key.jks
- name: Create key.properties
run: |
cat <<EOF > android/key.properties
storePassword=${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword=${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyAlias=release
storeFile=../key.jks
EOF
env:
ANDROID_KEY_STORE_PASSWORD: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
- name: Release To Play Store
uses: maierj/fastlane-action@v3.1.0
with:
lane: 'release_play_store'
subdirectory: android
options: '{ "version_number": "${{ inputs.version_number }}" }'
env:
APP_PACKAGE_NAME: ${{ secrets.APP_PACKAGE_NAME }}
- name: Build APK
uses: maierj/fastlane-action@v3.1.0
with:
lane: 'build_apk'
subdirectory: android
options: '{ "version_number": "${{ inputs.version_number }}" }'
- name: Upload APK Artifact to GitHub Release
run: gh release upload ${{ inputs.version_number }} build/app/outputs/flutter-apk/Classipod-Android.apk
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}