forked from resend/resend-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (106 loc) · 3.74 KB
/
release.yml
File metadata and controls
120 lines (106 loc) · 3.74 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
name: Release
on:
push:
tags:
- 'v*'
concurrency:
group: release
cancel-in-progress: false
jobs:
test-binary:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: bun-darwin-arm64
binary: dist/resend
flags: "--bytecode"
- os: ubuntu-latest
target: bun-linux-x64
binary: dist/resend
flags: "--bytecode"
- os: windows-latest
target: bun-windows-x64
binary: dist/resend.exe
flags: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build binary
run: bun build --compile --minify --sourcemap ${{ matrix.flags }} src/cli.ts --target=${{ matrix.target }} --outfile ${{ matrix.binary }}
- name: Verify binary runs
run: ${{ matrix.binary }} --version
release:
needs: test-binary
permissions:
contents: write
runs-on: blacksmith-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build binaries
run: |
bun build --compile --minify --sourcemap --bytecode src/cli.ts --target=bun-darwin-arm64 --outfile dist/resend-darwin-arm64
bun build --compile --minify --sourcemap --bytecode src/cli.ts --target=bun-darwin-x64 --outfile dist/resend-darwin-x64
bun build --compile --minify --sourcemap --bytecode src/cli.ts --target=bun-linux-x64 --outfile dist/resend-linux-x64
bun build --compile --minify --sourcemap --bytecode src/cli.ts --target=bun-linux-arm64 --outfile dist/resend-linux-arm64
bun build --compile --minify --sourcemap src/cli.ts --target=bun-windows-x64 --outfile dist/resend-windows-x64.exe
- name: Verify binaries
run: |
for f in dist/resend-darwin-arm64 dist/resend-darwin-x64 \
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-darwin-arm64 resend-darwin-x64 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: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
body: |
## Install
**macOS / Linux**
```sh
curl -fsSL https://resend.com/install.sh | bash
```
**Windows (PowerShell)**
```pwsh
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
notify-tap:
name: Trigger Homebrew Tap Update
needs: release
runs-on: ubuntu-latest
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}"