-
Notifications
You must be signed in to change notification settings - Fork 0
219 lines (180 loc) · 5.54 KB
/
Copy pathrelease.yml
File metadata and controls
219 lines (180 loc) · 5.54 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
concurrency:
group: release
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run tests
run: bun run test
- name: Build TypeScript
run: bun run build
- name: Run integration tests
run: bun run test:integration
env:
CERTMAN_API_KEY: ${{ secrets.CERTMAN_API_KEY }}
build:
needs: test
strategy:
matrix:
include:
- os: ubuntu-latest
target: linux-x64
platform: linux
arch: amd64
- os: ubuntu-latest
target: linux-arm64
platform: linux
arch: arm64
- os: macos-latest
target: darwin-x64
platform: darwin
arch: amd64
- os: macos-latest
target: darwin-arm64
platform: darwin
arch: arm64
- os: windows-latest
target: windows-x64
platform: windows
arch: amd64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build TypeScript
run: bun run build
- name: Build binary
shell: bash
run: |
BINARY_NAME="certman-${{ matrix.platform }}-${{ matrix.arch }}"
if [ "${{ matrix.platform }}" = "windows" ]; then
bun build dist/index.js --compile --target=bun-${{ matrix.target }} --outfile="${BINARY_NAME}.exe"
else
bun build dist/index.js --compile --target=bun-${{ matrix.target }} --outfile="${BINARY_NAME}"
fi
- name: Create tar.gz archive
shell: bash
run: |
BINARY_NAME="certman-${{ matrix.platform }}-${{ matrix.arch }}"
if [ "${{ matrix.platform }}" = "windows" ]; then
tar -czvf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}.exe"
else
tar -czvf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
fi
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: certman-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
path: certman-*.tar.gz
retention-days: 7
build-deb:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v6
- name: Download linux binary
uses: actions/download-artifact@v7
with:
name: certman-linux-${{ matrix.arch }}.tar.gz
path: .
- name: Extract binary
run: |
mkdir -p bin
tar -xzvf "certman-linux-${{ matrix.arch }}.tar.gz" -C bin/
- name: Build Debian package
run: |
VERSION="${GITHUB_REF_NAME#v}"
./scripts/build-deb.sh "$VERSION" "${{ matrix.arch }}"
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: certman-linux-${{ matrix.arch }}.deb
path: deb/*.deb
retention-days: 7
release:
needs: [build, build-deb]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: artifacts/
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/**/*
generate_release_notes: true
update-homebrew:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Download artifacts
uses: actions/download-artifact@v7
with:
path: artifacts/
- name: Generate Homebrew formula
run: |
VERSION="${GITHUB_REF_NAME#v}"
VERSION="$VERSION" ARTIFACTS_DIR="artifacts" bun run scripts/update-homebrew.ts
- name: Push to homebrew-tap
env:
SSH_PRIVATE_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan github.com >> ~/.ssh/known_hosts
git clone git@github.com:certman/homebrew-tap.git tap --config core.sshCommand="ssh -i ~/.ssh/deploy_key"
cp certman.rb tap/certman.rb
cd tap
git config user.name "certman-release-bot"
git config user.email "certman-release-bot@certman.app"
git config core.sshCommand "ssh -i ~/.ssh/deploy_key"
git add certman.rb
git diff --staged --quiet || git commit -m "certman ${GITHUB_REF_NAME#v}"
git push