-
Notifications
You must be signed in to change notification settings - Fork 0
319 lines (265 loc) · 9.28 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
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#
# DO NOT EDIT!
# This file was autogenerated by Carson.
# Changes may cause incorrect behavior and will be lost when the file is regenerated.
#
# Run `npx carson update workspace` to regenerate.
#
name: Release
on: [push, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release_main_branch:
name: Release
if: ${{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Configure git
run: |
git config user.email "bot@mazanec.dev"
git config user.name "Bot"
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- uses: superfly/flyctl-actions/setup-flyctl@master
- uses: edgedb/setup-edgedb@v1
with:
server-version: none
- name: Install packages
run: npm ci
- name: Check for changes
run: |
git config core.filemode false
git_status=$(git status --porcelain)
if [[ -n $git_status ]]; then
echo "You have uncommitted changes!"
git diff
git config --unset core.filemode
exit 1
fi
git config --unset core.filemode
- name: Migrate "dram"
run: |
edgedb migrate --schema-dir apps/dram/dbschema
env:
EDGEDB_INSTANCE: jakubmazanec/whisky
EDGEDB_BRANCH: ${{ github.ref_name }}
EDGEDB_SECRET_KEY: ${{ secrets.JAKUBMAZANEC_WHISKY_EDGEDB_TOKEN }}
- name: Test
run: npm test -- --filter=!dram
- name: Test "dram"
run: |
npm run test -- --filter=dram
env:
EDGEDB_INSTANCE: jakubmazanec/whisky
EDGEDB_BRANCH: ${{ github.ref_name }}
EDGEDB_SECRET_KEY: ${{ secrets.JAKUBMAZANEC_WHISKY_EDGEDB_TOKEN }}
- name: Check for changes
run: |
git config core.filemode false
git_status=$(git status --porcelain)
if [[ -n $git_status ]]; then
echo "You have uncommitted changes!"
git diff
git config --unset core.filemode
exit 1
fi
git config --unset core.filemode
- name: Build packages
run: npm run build -- --filter=!dram --filter=!somewhere
- name: Authenticate to npm registry
run: |
echo "//registry.npmjs.com/:_authToken=NPM_TOKEN" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version packages
run: |
npx changeset version
git status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit changes
run: |
git add -A
git reset .npmrc
git status
git commit -m"Release [skip actions]"
- name: Publish packages
run: |
npx changeset publish --no-git-tag
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true' # must be string, not boolean
- name: Update lockfile
run: |
npm install
git add package-lock.json
git status
git commit --amend --no-edit
- name: Update Carson
run: |
git add **/.carson/*.snapshot
git status
git commit --amend --no-edit
- name: Add git tags
run: |
npx changeset tag
- name: Push changes
run: |
git push --follow-tags
- name: Checkout development branch
run: |
git fetch -p origin
git checkout -B development
git branch --set-upstream-to=origin/development development
git reset --hard origin/development
- name: Merge and commit
run: |
git merge main --no-verify
git push -u origin development --no-verify
- name: Checkout main branch
run: |
git checkout -B main
git branch --set-upstream-to=origin/main main
git reset --hard origin/main
git pull
- name: Deploy "dram"
run: |
npm run deploy --workspace dram -- --build-arg "VITE_APP_URL=$VITE_APP_URL" --build-arg "EDGEDB_INSTANCE=$EDGEDB_INSTANCE" --build-arg "EDGEDB_BRANCH=$EDGEDB_BRANCH" --build-secret "EDGEDB_SECRET_KEY=$EDGEDB_SECRET_KEY"
env:
VITE_APP_URL: https://dram.mazanec.dev
EDGEDB_INSTANCE: jakubmazanec/whisky
EDGEDB_BRANCH: ${{ github.ref_name }}
EDGEDB_SECRET_KEY: ${{ secrets.JAKUBMAZANEC_WHISKY_EDGEDB_TOKEN }}
FLY_ACCESS_TOKEN: ${{ secrets.FLY_TOKEN }}
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
- name: Deploy "somewhere"
run: |
npm run deploy --workspace somewhere -- --build-arg "VITE_APP_URL=$VITE_APP_URL"
env:
VITE_APP_URL: https://somewhere.fly.dev
FLY_ACCESS_TOKEN: ${{ secrets.FLY_TOKEN }}
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
release_development_branch:
name: Release preview
if: ${{ github.ref_name == 'development' }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Configure git
run: |
git config user.email "bot@mazanec.dev"
git config user.name "Bot"
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- uses: superfly/flyctl-actions/setup-flyctl@master
- uses: edgedb/setup-edgedb@v1
with:
server-version: none
- name: Install packages
run: npm ci
- name: Check for changes
run: |
git config core.filemode false
git_status=$(git status --porcelain)
if [[ -n $git_status ]]; then
echo "You have uncommitted changes!"
git diff
git config --unset core.filemode
exit 1
fi
git config --unset core.filemode
- name: Migrate "dram"
run: |
edgedb migrate --schema-dir apps/dram/dbschema
env:
EDGEDB_INSTANCE: jakubmazanec/whisky
EDGEDB_BRANCH: ${{ github.ref_name }}
EDGEDB_SECRET_KEY: ${{ secrets.JAKUBMAZANEC_WHISKY_EDGEDB_TOKEN }}
- name: Test
run: npm test -- --filter=!dram
- name: Test "dram"
run: |
npm run test -- --filter=dram
env:
EDGEDB_INSTANCE: jakubmazanec/whisky
EDGEDB_BRANCH: ${{ github.ref_name }}
EDGEDB_SECRET_KEY: ${{ secrets.JAKUBMAZANEC_WHISKY_EDGEDB_TOKEN }}
- name: Check for changes
run: |
git config core.filemode false
git_status=$(git status --porcelain)
if [[ -n $git_status ]]; then
echo "You have uncommitted changes!"
git diff
git config --unset core.filemode
exit 1
fi
git config --unset core.filemode
- name: Build packages
run: npm run build -- --filter=!dram --filter=!somewhere
- name: Update documentation
run: |
npm run document --if-present
npm run format --if-present
git add **/docs/**
git status
git commit -m"Update docs [skip actions]"
git push --force
continue-on-error: true
- name: Authenticate to npm registry
run: |
echo "//registry.npmjs.com/:_authToken=NPM_TOKEN" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version packages
run: |
npx changeset version --snapshot next.$(git rev-parse --short HEAD) --snapshot-prerelease-template "{tag}"
git status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish packages
run: |
npx changeset publish --tag next --no-git-tag
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true' # must be string, not boolean
- name: Deploy "dram"
run: |
npm run deploy --workspace dram -- --app dram-next --build-arg "VITE_APP_URL=$VITE_APP_URL" --build-arg "EDGEDB_INSTANCE=$EDGEDB_INSTANCE" --build-arg "EDGEDB_BRANCH=$EDGEDB_BRANCH" --build-secret "EDGEDB_SECRET_KEY=$EDGEDB_SECRET_KEY"
env:
VITE_APP_URL: https://dram-next.fly.dev
EDGEDB_INSTANCE: jakubmazanec/whisky
EDGEDB_BRANCH: ${{ github.ref_name }}
EDGEDB_SECRET_KEY: ${{ secrets.JAKUBMAZANEC_WHISKY_EDGEDB_TOKEN }}
FLY_ACCESS_TOKEN: ${{ secrets.FLY_TOKEN }}
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
- name: Deploy "somewhere"
run: |
npm run deploy --workspace somewhere -- --app somewhere-next --build-arg "VITE_APP_URL=$VITE_APP_URL"
env:
VITE_APP_URL: https://somewhere-next.fly.dev
FLY_ACCESS_TOKEN: ${{ secrets.FLY_TOKEN }}
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}