-
Notifications
You must be signed in to change notification settings - Fork 80
257 lines (255 loc) · 10 KB
/
release.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
247
248
249
250
251
252
253
254
255
256
257
name: Release
on:
workflow_dispatch:
inputs:
next_version:
default: "0.0.0"
description: "The next version to be released"
required: false
stable:
default: false
description: "Is this version stable?"
type: boolean
required: false
jobs:
update-changelog:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
fetch-depth: 0
- uses: subosito/[email protected]
with:
flutter-version-file: app/pubspec.yaml
- name: Setup git
id: setup
run: |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)"
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]]
BUTTERFLY_VERSION="${BASH_REMATCH[1]}"
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}"
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV
git config --global user.email "[email protected]"
git config --global user.name "Linwood CI"
- name: Update changelog
run: |
git fetch
git pull origin
dart pub get -C tools
dart run tools/set_version.dart --build-number keep ${{ env.BUTTERFLY_VERSION }} --changelog
git add .
git commit -m "Add changelog of v${{ env.BUTTERFLY_VERSION }}"
git push origin
- name: Merge in develop
if: ${{ github.ref == 'refs/heads/main' }}
run: |
git fetch
git checkout develop
git pull origin develop
git merge main --strategy-option ours
git push origin develop
release:
runs-on: ubuntu-24.04
needs:
- update-changelog
outputs:
version: ${{ steps.setup.outputs.BUTTERFLY_VERSION }}
build_number: ${{ steps.setup.outputs.BUTTERFLY_BUILD_NUMBER }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
ref: ${{ github.ref }}
fetch-depth: 0
- uses: subosito/[email protected]
with:
flutter-version-file: app/pubspec.yaml
- name: Setup git
id: setup
shell: bash
run: |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)"
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]]
BUTTERFLY_VERSION="${BASH_REMATCH[1]}"
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_OUTPUT
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}"
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_OUTPUT
git config --global user.email "[email protected]"
git config --global user.name "Linwood CI"
- name: Create tag
run: |
BUTTERFLY_VERSION="${{ env.BUTTERFLY_VERSION }}"
git tag -fa v${{ env.BUTTERFLY_VERSION }} -m "Release ${BUTTERFLY_VERSION}"
git push origin v${BUTTERFLY_VERSION} -f
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
fetch-depth: 0
- name: Create release
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ github.event.inputs.stable != 'true' }}
tag_name: v${{ env.BUTTERFLY_VERSION }}
name: v${{ env.BUTTERFLY_VERSION }}
token: ${{ secrets.CI_PAT }}
body_path: metadata/en-US/changelogs/${{ env.BUTTERFLY_BUILD_NUMBER }}.txt
- name: Retag stable
if: ${{ github.event.inputs.stable == 'true' || github.ref == 'refs/heads/main' }}
run: |
git tag -fa stable -m "Find all stable releases here"
git push origin HEAD:stable -f
- name: Retag nightly
if: ${{ github.event.inputs.stable != 'true' && github.ref == 'refs/heads/develop' }}
run: |
git tag -fa nightly -m "Find all nightly releases here"
git push origin HEAD:nightly -f
- name: Merge in main
if: ${{ github.ref == 'refs/heads/develop' && github.event.inputs.stable == 'true' }}
run: |
git fetch
git checkout main
git pull origin main
git merge develop --strategy-option ours
git push origin main
set-next-version:
runs-on: ubuntu-24.04
needs:
- update-changelog
- release
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
fetch-depth: 0
- uses: subosito/[email protected]
with:
flutter-version-file: app/pubspec.yaml
- name: Setup git
id: setup
run: |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)"
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]]
BUTTERFLY_VERSION="${BASH_REMATCH[1]}"
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}"
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV
git config --global user.email "[email protected]"
git config --global user.name "Linwood CI"
- name: Set next version
run: |
git fetch
git pull origin
dart pub get -C tools
dart run tools/set_version.dart --build-number increment ${{ github.event.inputs.next_version }} --no-changelog
git add .
git commit -m "Update Version to ${{ github.event.inputs.next_version }}"
git push origin
- name: Merge develop
if: ${{ github.ref == 'refs/heads/main' }}
run: |
git fetch
git checkout develop
git pull origin develop
git merge main --strategy-option ours
git push origin develop
bump-version:
runs-on: ubuntu-24.04
needs:
- update-changelog
- release
- set-next-version
steps:
- name: Checkout main
if: ${{ github.ref == 'refs/heads/develop' }}
uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
fetch-depth: 0
ref: main
- name: Checkout develop
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
fetch-depth: 0
ref: develop
- name: Setup git
id: setup
run: |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)"
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]]
BUTTERFLY_VERSION="${BASH_REMATCH[1]}"
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}"
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV
git config --global user.email "[email protected]"
git config --global user.name "Linwood CI"
- uses: subosito/[email protected]
with:
flutter-version-file: app/pubspec.yaml
- name: Bump version
run: |
git fetch
git pull origin
dart pub get -C tools
dart run tools/set_version.dart --build-number increment ${{ env.BUTTERFLY_VERSION }} --no-changelog
git add .
git commit -m "Bump version"
git push origin
- name: Update develop
if: ${{ github.ref == 'refs/heads/develop' }}
run: |
git fetch
git checkout develop
git pull origin
git merge main --strategy-option ours
git push origin develop
notify:
runs-on: ubuntu-24.04
needs: [release]
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
- name: Get information
shell: bash
run: |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)"
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]]
BUTTERFLY_VERSION="${BASH_REMATCH[1]}"
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}"
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV
echo 'BUTTERFLY_CHANGELOG<<EOF' >> $GITHUB_ENV
cat metadata/en-US/changelogs/${BUTTERFLY_BUILD_NUMBER}.txt >> $GITHUB_ENV
echo '' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Discord Webhook Action
uses: tsickert/[email protected]
if: ${{ github.event.inputs.stable == 'true' || github.ref == 'refs/heads/main' }}
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
embed-title: ${{ env.BUTTERFLY_VERSION }}
embed-description: ${{ env.BUTTERFLY_CHANGELOG }}
embed-url: https://github.com/LinwoodDev/butterfly/releases/tag/v${{ env.BUTTERFLY_VERSION }}
content: |
Version ${{ env.BUTTERFLY_VERSION }} released!
Download it here: https://butterfly.linwood.dev/downloads
https://github.com/LinwoodDev/butterfly/releases/tag/v${{ env.BUTTERFLY_VERSION }}
- name: Discord Webhook Action
uses: tsickert/[email protected]
if: ${{ github.event.inputs.stable == 'false' && github.ref == 'refs/heads/develop' }}
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
embed-title: ${{ env.BUTTERFLY_VERSION }}
embed-description: ${{ env.BUTTERFLY_CHANGELOG }}
embed-url: https://github.com/LinwoodDev/butterfly/releases/tag/v${{ env.BUTTERFLY_VERSION }}
content: |
Pre-release version ${{ env.BUTTERFLY_VERSION }} released!
Download it here: https://butterfly.linwood.dev/downloads
Please note that this is a pre-release version and is not intended for production use.
Read more about it here: https://butterfly.linwood.dev/community/nightly