Repository navigation
203 lines (173 loc) · 6 KB
/
Copy pathrelease.yml
File metadata and controls
203 lines (173 loc) · 6 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
name: release
on:
push:
tags: ['v*']
workflow_dispatch:
# a half-uploaded release must never be clobbered by a second run of the same
# tag, so runs queue rather than cancel each other.
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
jobs:
# resolves the version once and opens the draft, so the twelve build jobs
# below attach to an existing release instead of racing to create one.
prepare:
name: prepare
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
is_release: ${{ steps.meta.outputs.is_release }}
version: ${{ steps.meta.outputs.version }}
prerelease: ${{ steps.meta.outputs.prerelease }}
steps:
- uses: actions/checkout@v7
# refuses a tag that disagrees with Cargo.toml, before anything builds.
# runnable locally: scripts/release-version.sh tag v0.6.0
- name: resolve version
id: meta
run: ./scripts/release-version.sh | tee -a "$GITHUB_OUTPUT"
# opened as a draft: the release only becomes visible once publish has
# confirmed every tarball landed. notes are the boilerplate below plus
# github's generated changelog, which it appends.
- name: open draft release
uses: softprops/action-gh-release@v3
if: steps.meta.outputs.is_release == 'true'
with:
draft: true
prerelease: ${{ steps.meta.outputs.prerelease }}
generate_release_notes: true
body: |
## setup
- download and extract the tarball
- `cp .env.example .env`
- `$EDITOR .env`
## run a workflow
- `./flow-cli ./workflows/uuid-echo.json`
## launch the webui
- `./flow-server`
build-macos:
name: build macos (${{ matrix.arch }}, ${{ matrix.python }})
needs: prepare
permissions:
contents: write
strategy:
fail-fast: false
matrix:
arch: [arm64]
python: ['3.11', '3.12', '3.13', 'nopy']
include:
- arch: arm64
runner: macos-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v7
with:
node-version: '20'
cache: npm
cache-dependency-path: ui/package-lock.json
- uses: actions/setup-python@v7
if: matrix.python != 'nopy'
with:
python-version: ${{ matrix.python }}
- name: install ui deps
run: cd ui && npm ci
- name: bundle
run: |
set -- --platform darwin --arch "${{ matrix.arch }}"
if [ "${{ matrix.python }}" = "nopy" ]; then set -- "$@" --no-python; fi
./scripts/bundle-release.sh "$@"
- uses: actions/upload-artifact@v7
with:
name: flow-macos-${{ matrix.arch }}-${{ matrix.python }}
path: dist/*.tgz
- name: attach to draft
uses: softprops/action-gh-release@v3
if: needs.prepare.outputs.is_release == 'true'
with:
draft: true
files: dist/*.tgz
build-linux:
name: build linux (${{ matrix.arch }}, ${{ matrix.python }})
needs: prepare
runs-on: ${{ matrix.runner }}
container: ${{ matrix.python == 'nopy' && 'debian:trixie' || format('python:{0}-trixie', matrix.python) }}
# a container job gets `sh`, not bash, whatever the image ships. saying so
# is what makes shellcheck hold the steps below to POSIX -- a bash array
# here is a syntax error that only shows up once a tag is already pushed.
defaults:
run:
shell: sh
permissions:
contents: write
strategy:
fail-fast: false
matrix:
arch: [x86_64, arm64]
python: ['3.11', '3.12', '3.13', 'nopy']
include:
- arch: x86_64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: install system deps
run: |
apt-get update
apt-get install -y --no-install-recommends \
curl build-essential pkg-config git ca-certificates \
libssl-dev nodejs npm
- uses: actions/checkout@v7
- name: mark workspace safe for git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: dtolnay/rust-toolchain@stable
- name: install ui deps
run: cd ui && npm ci
- name: bundle
run: |
set -- --platform linux --arch "${{ matrix.arch }}"
if [ "${{ matrix.python }}" = "nopy" ]; then set -- "$@" --no-python; fi
./scripts/bundle-release.sh "$@"
- uses: actions/upload-artifact@v7
with:
name: flow-linux-${{ matrix.arch }}-${{ matrix.python }}
path: dist/*.tgz
- name: attach to draft
uses: softprops/action-gh-release@v3
if: needs.prepare.outputs.is_release == 'true'
with:
draft: true
files: dist/*.tgz
# the draft stays a draft unless every tarball built, so a partial matrix
# leaves something to fix and re-run rather than a broken public release.
publish:
name: publish
needs: [prepare, build-macos, build-linux]
if: needs.prepare.outputs.is_release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
# naming permissions at all drops every scope not listed, and
# download-artifact needs this one to read the matrix's uploads
actions: read
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: checksum the tarballs
run: |
cd dist
sha256sum -- *.tgz > SHA256SUMS
cat SHA256SUMS
- name: publish release
uses: softprops/action-gh-release@v3
with:
draft: false
prerelease: ${{ needs.prepare.outputs.prerelease }}
make_latest: ${{ needs.prepare.outputs.prerelease == 'true' && 'false' || 'true' }}
files: dist/SHA256SUMS