-
-
Notifications
You must be signed in to change notification settings - Fork 222
230 lines (221 loc) · 8.1 KB
/
release.yaml
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
name: Release Workflow
on:
release:
types:
- created
concurrency:
group: release_workflow
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install nodejs -y
- name: Remove Emoji Font
run: |
rm -rf fonts/NotoEmoji
yq -i 'del( .flutter.fonts[] | select(.family == "NotoEmoji") )' pubspec.yaml
- run: flutter pub get
- name: Prepare web
run: ./scripts/prepare-web.sh
- name: Build Release Web
run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/web/"
- name: Create archive
run: tar -czf fluffychat-web.tar.gz build/web/
- name: Upload Web Build
uses: actions/upload-artifact@v4
with:
name: Web Build
path: fluffychat-web.tar.gz
- name: Upload to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: fluffychat-web.tar.gz
asset_name: fluffychat-web.tar.gz
asset_content_type: application/gzip
- name: Build Website
run: |
cd docs && npx tailwindcss -o ./tailwind.css --minify && cd ..
mv docs public
mv repo public || true
mv build/web/ public/web
cp public/web -r public/nightly
- name: Deploy to GitHub Pages
if: startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.PAGES_DEPLOY_TOKEN }}
publish_dir: ./public
publish_branch: gh-pages
cname: fluffychat.im
build_apk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'zulu'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Apply Google Services Patch
run: git apply ./scripts/enable-android-google-services.patch
- name: Remove Emoji Font
run: |
rm -rf fonts/NotoEmoji
yq -i 'del( .flutter.fonts[] | select(.family == "NotoEmoji") )' pubspec.yaml
- run: flutter pub get
- name: Prepare Android Release Build
env:
FDROID_KEY: ${{ secrets.FDROID_KEY }}
FDROID_KEY_PASS: ${{ secrets.FDROID_KEY_PASS }}
PLAYSTORE_DEPLOY_KEY: ${{ secrets.PLAYSTORE_DEPLOY_KEY }}
run: ./scripts/prepare-android-release.sh
- run: flutter build apk --release
- name: Upload to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/app/outputs/apk/release/app-release.apk
asset_name: fluffychat.apk
asset_content_type: application/vnd.android.package-archive
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 libssl-dev -y
- run: flutter pub get
- run: flutter build linux --release --target-platform linux-x64
- name: Create archive
run: tar -czf fluffychat-linux-x64.tar.gz -C build/linux/x64/release/bundle/ .
- name: Upload to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: fluffychat-linux-x64.tar.gz
asset_name: fluffychat-linux-x64.tar.gz
asset_content_type: application/gzip
deploy_playstore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'zulu'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install Fastlane
run: gem install fastlane -NV
- name: Apply Google Services Patch
run: git apply ./scripts/enable-android-google-services.patch
- name: Remove Emoji Font
run: |
rm -rf fonts/NotoEmoji
yq -i 'del( .flutter.fonts[] | select(.family == "NotoEmoji") )' pubspec.yaml
- run: flutter pub get
- name: Prepare Android Release Build
env:
FDROID_KEY: ${{ secrets.FDROID_KEY }}
FDROID_KEY_PASS: ${{ secrets.FDROID_KEY_PASS }}
PLAYSTORE_DEPLOY_KEY: ${{ secrets.PLAYSTORE_DEPLOY_KEY }}
run: ./scripts/prepare-android-release.sh
- name: Build Android Release
run: flutter build appbundle --target-platform android-arm,android-arm64,android-x64
- name: Get Tag Name
id: tag_name
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})"
- name: Deploy Android Release
run: |
mkdir -p build/android
cp build/app/outputs/bundle/release/app-release.aab build/android/
cd android
bundle install
bundle update fastlane
bundle exec fastlane deploy_internal_test
if [[ $GITHUB_REF_NAME == rc* ]]; then
bundle exec fastlane deploy_candidate
else
bundle exec fastlane deploy_release
fi
cd ..
promote_snapcraft:
runs-on: ubuntu-latest
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2
- name: Get Tag Name
id: tag_name
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})"
- name: Promote Snap
env: # Workaround for https://github.com/snapcore/snapcraft/issues/4439
SNAPCRAFT_HAS_TTY: "true"
run: |
if [[ $GITHUB_REF_NAME == rc* ]]; then
yes | snapcraft promote fluffychat --from-channel edge --to-channel candidate
else
yes | snapcraft promote fluffychat --from-channel edge --to-channel stable
fi
deploy_docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}