-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.23 KB
/
Copy pathrelease-cli.yml
File metadata and controls
82 lines (69 loc) · 2.23 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
name: Release CLI
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'npm dist-tag (e.g. latest, next)'
required: false
default: 'latest'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.1
- name: Setup Node.js (for npm publish + provenance)
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: bun install
- name: Typecheck
run: bun run typecheck
- name: Test
run: bun test
- name: Verify tag matches package.json version
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION="$(node -p "require('./package.json').version")"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)" >&2
exit 1
fi
- name: Build single-file binaries
run: bun run build:binaries
- name: Compute SHA256SUMS
working-directory: dist/binaries
run: shasum -a 256 messages-* > SHA256SUMS
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--generate-notes \
dist/binaries/messages-darwin-arm64 \
dist/binaries/messages-darwin-x64 \
dist/binaries/messages-linux-x64 \
dist/binaries/messages-linux-arm64 \
dist/binaries/messages-windows-x64.exe \
dist/binaries/SHA256SUMS
- name: Build npm bundle
run: bun run build
- name: Publish to npm
run: npm publish --access public --provenance --tag "${{ github.event.inputs.tag || 'latest' }}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}