-
Notifications
You must be signed in to change notification settings - Fork 33
280 lines (276 loc) · 10.3 KB
/
release.yml
File metadata and controls
280 lines (276 loc) · 10.3 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
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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: release
cancel-in-progress: false
jobs:
preflight:
runs-on: depot-ubuntu-24.04
steps:
- name: Verify PostHog key is configured
run: |
if [ -z "${{ secrets.POSTHOG_PUBLIC_KEY }}" ]; then
echo "::error::POSTHOG_PUBLIC_KEY secret is not set"
exit 1
fi
test-binary:
needs: preflight
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: node24-macos-arm64
binary: dist/resend
- os: ubuntu-latest
target: node24-linux-x64
binary: dist/resend
- os: windows-latest
target: node24-win-x64
binary: dist/resend.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: pnpm/action-setup@08c4be7e2e672a47d11bd04269e27e5f3e8529cb # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Node bundle
run: pnpm build
env:
POSTHOG_PUBLIC_KEY: ${{ secrets.POSTHOG_PUBLIC_KEY }}
- name: Build binary
run: pnpm exec pkg dist/cli.cjs --config package.json --compress Brotli --target ${{ matrix.target }} --output ${{ matrix.binary }}
- name: Verify binary runs
run: |
${{ matrix.binary }} --version
${{ matrix.binary }} --help
test-binary-linux-arm64:
needs: preflight
runs-on: depot-ubuntu-24.04-4
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: pnpm/action-setup@08c4be7e2e672a47d11bd04269e27e5f3e8529cb # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Node bundle
run: pnpm build
env:
POSTHOG_PUBLIC_KEY: ${{ secrets.POSTHOG_PUBLIC_KEY }}
- name: Build binary (no-bytecode workaround)
run: pnpm exec pkg dist/cli.cjs --config package.json --compress Brotli --target node24-linux-arm64 --output dist/resend --no-bytecode --public-packages "*" --public
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
with:
platforms: arm64
- name: Verify binary runs under arm64 emulation
run: |
docker run --rm --platform linux/arm64 \
-v "$PWD/dist/resend:/usr/local/bin/resend" \
debian:bookworm-slim \
sh -c "resend --version && resend --help"
build-macos:
needs: [test-binary, test-binary-linux-arm64]
runs-on: macos-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: pnpm/action-setup@08c4be7e2e672a47d11bd04269e27e5f3e8529cb # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Node bundle
run: pnpm build
env:
POSTHOG_PUBLIC_KEY: ${{ secrets.POSTHOG_PUBLIC_KEY }}
- name: Build macOS binaries
run: |
pnpm exec pkg dist/cli.cjs --config package.json --compress Brotli --target node24-macos-arm64 --output dist/resend-darwin-arm64
pnpm exec pkg dist/cli.cjs --config package.json --compress Brotli --target node24-macos-x64 --output dist/resend-darwin-x64
- name: Verify signatures
run: |
codesign -v dist/resend-darwin-arm64
codesign -v dist/resend-darwin-x64
- name: Package archives
run: |
cd dist
for bin in resend-darwin-arm64 resend-darwin-x64; do
cp "$bin" resend
chmod +x resend
tar -czf "${bin}.tar.gz" resend
rm resend
done
- name: Upload macOS artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: macos-archives
path: |
dist/resend-darwin-arm64.tar.gz
dist/resend-darwin-x64.tar.gz
build-linux-windows:
needs: [test-binary, test-binary-linux-arm64]
runs-on: depot-ubuntu-24.04-4
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: pnpm/action-setup@08c4be7e2e672a47d11bd04269e27e5f3e8529cb # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Node bundle
run: pnpm build
env:
POSTHOG_PUBLIC_KEY: ${{ secrets.POSTHOG_PUBLIC_KEY }}
- name: Build binaries
run: |
pnpm exec pkg dist/cli.cjs --config package.json --compress Brotli --target node24-linux-x64 --output dist/resend-linux-x64
pnpm exec pkg dist/cli.cjs --config package.json --compress Brotli --target node24-linux-arm64 --output dist/resend-linux-arm64 --no-bytecode --public-packages "*" --public
pnpm exec pkg dist/cli.cjs --config package.json --compress Brotli --target node24-win-x64 --output dist/resend-windows-x64.exe
- name: Verify binaries
run: |
for f in dist/resend-linux-x64 dist/resend-linux-arm64 dist/resend-windows-x64.exe; do
[ -s "$f" ] || { echo "Missing or empty: $f"; exit 1; }
done
- name: Package archives
run: |
cd dist
for bin in resend-linux-x64 resend-linux-arm64; do
cp "$bin" resend
chmod +x resend
tar -czf "${bin}.tar.gz" resend
rm resend
done
cp resend-windows-x64.exe resend.exe
zip resend-windows-x64.zip resend.exe
rm resend.exe
- name: Upload Linux/Windows artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: linux-windows-archives
path: |
dist/resend-linux-x64.tar.gz
dist/resend-linux-arm64.tar.gz
dist/resend-windows-x64.zip
release:
if: github.event_name != 'workflow_dispatch'
needs: [build-macos, build-linux-windows]
permissions:
contents: write
runs-on: depot-ubuntu-24.04
outputs:
prerelease: ${{ steps.meta.outputs.prerelease }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: dist
merge-multiple: true
- name: Verify all archives exist
run: |
for f in dist/resend-darwin-arm64.tar.gz dist/resend-darwin-x64.tar.gz \
dist/resend-linux-x64.tar.gz dist/resend-linux-arm64.tar.gz \
dist/resend-windows-x64.zip; do
[ -s "$f" ] || { echo "Missing or empty: $f"; exit 1; }
done
- name: Detect pre-release
id: meta
run: |
if [[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "prerelease=false" >> "$GITHUB_OUTPUT"
echo "make_latest=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=true" >> "$GITHUB_OUTPUT"
echo "make_latest=false" >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
with:
prerelease: ${{ steps.meta.outputs.prerelease }}
make_latest: ${{ steps.meta.outputs.make_latest }}
generate_release_notes: true
body: |
## Install
**cURL**
```sh
curl -fsSL https://resend.com/install.sh | bash
```
**Node.js**
```sh
npm install -g resend-cli
```
**Homebrew (macOS / Linux)**
```sh
brew install resend/cli/resend
```
**PowerShell (Windows)**
```sh
irm https://resend.com/install.ps1 | iex
```
files: |
dist/resend-darwin-arm64.tar.gz
dist/resend-darwin-x64.tar.gz
dist/resend-linux-x64.tar.gz
dist/resend-linux-arm64.tar.gz
dist/resend-windows-x64.zip
publish-npm:
if: github.event_name != 'workflow_dispatch'
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: pnpm/action-setup@08c4be7e2e672a47d11bd04269e27e5f3e8529cb # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Determine npm tag
id: npm-tag
run: |
TAG="${{ github.ref_name }}"
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "tag=latest" >> "$GITHUB_OUTPUT"
else
PRERELEASE="${TAG#v[0-9]*.[0-9]*.[0-9]*-}"
echo "tag=${PRERELEASE%%[-.]*}" >> "$GITHUB_OUTPUT"
fi
- name: Publish to npm
run: npm publish --provenance --tag ${{ steps.npm-tag.outputs.tag }}
env:
POSTHOG_PUBLIC_KEY: ${{ secrets.POSTHOG_PUBLIC_KEY }}
notify-tap:
if: github.event_name != 'workflow_dispatch' && needs.release.outputs.prerelease == 'false'
name: Trigger Homebrew Tap Update
needs: release
runs-on: depot-ubuntu-24.04
permissions:
contents: read
steps:
- name: Dispatch publish-release workflow on tap
env:
GH_TOKEN: ${{ secrets.RELEASE_CLI_ON_HOMEBREW }}
run: |
gh workflow run publish-release.yml \
--repo resend/homebrew-cli \
--field version="${GITHUB_REF_NAME}" \
--field reviewer="${GITHUB_ACTOR}"