-
Notifications
You must be signed in to change notification settings - Fork 1
250 lines (216 loc) · 7.98 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
name: Release
on:
push:
# Sequence of patterns matched against refs/tags
# Unfortunately, regex are not fully supported in YAML files, so we cannot
# use the officially recommended regex to verify the semantic versioning tag
# https://github.com/semver/semver/blob/master/semver.md#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
tags:
- "v[0-9]+.[0-9]+.[0-9]+-?[a-zA-Z0-9]*"
jobs:
# docker-release:
# runs-on: ubuntu-latest
# services:
# postgres:
# image: postgres:13
# env:
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: nettuscheduler
# ports:
# - 5432:5432
# env:
# DATABASE_URL: postgresql://postgres:postgres@localhost/nettuscheduler
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set version env
# run: |
# # v1.0.0 --> 1.0.0
# VERSION=${GITHUB_REF#refs/*/}
# echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
# - uses: actions/cache@v4
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# scheduler/target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Login to DockerHub
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Run migrations
# run: |
# cd scheduler
# cargo install sqlx-cli --no-default-features --features postgres || true
# (cd crates/infra && sqlx migrate run)
# - name: Build and push
# uses: docker/build-push-action@v6
# with:
# context: ./scheduler
# push: true
# file: "{context}/debian.Dockerfile"
# tags: |
# fmeringdal/nettu-scheduler:latest
# fmeringdal/nettu-scheduler:${{ env.VERSION }}
# We don't use the Rust client for now
# To re-enable later
# rust-client-release:
# runs-on: ubuntu-latest
# needs: javascript-client-release
# services:
# postgres:
# image: postgres:13
# env:
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: nettuscheduler
# ports:
# - 5432:5432
# env:
# DATABASE_URL: postgresql://postgres:postgres@localhost/nettuscheduler
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Set version env
# run: |
# # v1.0.0 --> 1.0.0
# VERSION=${GITHUB_REF#refs/*/}
# echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
# - name: Wait for remote to become up to date
# run: |
# duration=15
# echo "sleeping $duration seconds ..."
# sleep $duration
# echo "sleeping $duration seconds ... DONE"
# - uses: actions/cache@v2
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# scheduler/target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# - name: Run migrations
# run: |
# cd scheduler
# cargo install sqlx-cli --no-default-features --features postgres || true
# (cd crates/infra && sqlx migrate run)
# - name: Login to crates.io
# env:
# CRATE_PUBLISH_TOKEN: ${{secrets.CRATE_PUBLISH_TOKEN}}
# run: |
# cargo login $CRATE_PUBLISH_TOKEN
# - name: Set version numbers
# run: |
# # What follows is a lot of search and replace magic for Cargo.toml to update
# # version number for a crate and its dependenices. It seems like there
# # is no good tool that can bump version numbers in a cargo workspace yet.
# cd scheduler
# cd crates/utils
# sed -i "0,/\(version *= *\).*/{s/\(version *= *\).*/\1\"$VERSION\"/}" ./Cargo.toml
# cd ../../
# cd crates/domain
# sed -i "0,/\(version *= *\).*/{s/\(version *= *\).*/\1\"$VERSION\"/}" ./Cargo.toml
# sed -i "s/path = \"..\/utils\", version = \"*.*.*\"/path = \"..\/utils\", version = \"$VERSION\"/" ./Cargo.toml
# cd ../../
# cd crates/api_structs
# sed -i "0,/\(version *= *\).*/{s/\(version *= *\).*/\1\"$VERSION\"/}" ./Cargo.toml
# sed -i "s/path = \"..\/domain\", version = \"*.*.*\"/path = \"..\/domain\", version = \"$VERSION\"/" ./Cargo.toml
# echo "api_structs toml"
# cat ./Cargo.toml
# echo "api_structs toml DONE"
# cd ../../
# cd crates/infra
# sed -i "0,/\(version *= *\).*/{s/\(version *= *\).*/\1\"$VERSION\"/}" ./Cargo.toml
# cd ../../
# cd crates/api
# sed -i "0,/\(version *= *\).*/{s/\(version *= *\).*/\1\"$VERSION\"/}" ./Cargo.toml
# cd ../../
# cd clients/rust
# sed -i "0,/\(version *= *\).*/{s/\(version *= *\).*/\1\"$VERSION\"/}" ./Cargo.toml
# sed -i "s/path = \"..\/..\/crates\/domain\", version = \"*.*.*\"/path = \"..\/..\/crates\/domain\", version = \"$VERSION\"/" ./Cargo.toml
# sed -i "s/path = \"..\/..\/crates\/api_structs\", version = \"*.*.*\"/path = \"..\/..\/crates\/api_structs\", version = \"$VERSION\"/" ./Cargo.toml
# echo "SDK toml"
# cat ./Cargo.toml
# echo "SDK toml DONE"
# cd ../../
# # Root Cargo.toml
# sed -i "0,/\(version *= *\).*/{s/\(version *= *\).*/\1\"$VERSION\"/}" ./Cargo.toml
# cargo check --all
# - name: Publish crates
# run: |
# cd scheduler
# cd crates/utils
# cargo publish --allow-dirty
# cd ../../
# # Make sure published version is available at crates.io
# sleep 30
# cd crates/domain
# cargo publish --allow-dirty
# cd ../../
# # Make sure published version is available at crates.io
# sleep 30
# cd crates/api_structs
# cargo publish --allow-dirty
# cd ../../
# # Make sure published version is available at crates.io
# sleep 30
# cd clients/rust
# cargo publish --allow-dirty
# cd ../../
# - name: Commit & Push version changes
# uses: actions-js/push@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: master
# message: |
# Autopublish: Update cargo workspace deps on release
javascript-client-release:
runs-on: ubuntu-latest
needs: docker-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set version env
run: |
# v1.0.0 --> 1.0.0
VERSION=${GITHUB_REF#refs/*/}
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install deps
run: |
cd scheduler/clients/javascript
pnpm install
- name: Set version number
run: |
cd scheduler/clients/javascript
pnpm version $VERSION
- name: Publish package
run: |
cd scheduler/clients/javascript
pnpm run deploy
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
# - name: Commit & Push version changes
# uses: actions-js/push@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: master
# message: |
# Autopublish: Update cargo workspace deps on release