-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 1.95 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (58 loc) · 1.95 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
name: release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Tag to build (e.g. v0.1.0). Required for manual runs."
required: true
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Resolve version
id: v
run: |
TAG="${{ github.event.inputs.tag || github.ref_name }}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun test
- name: Build binaries (cross-compiled)
run: |
for target in darwin-arm64 darwin-x64 linux-x64 linux-arm64; do
bun build --compile --target=bun-$target \
--outfile dist/camkit-$target/camkit \
packages/cli/src/camkit.ts
tar -czf dist/camkit-$target.tar.gz -C dist/camkit-$target camkit
done
- name: Generate checksums
run: |
cd dist
shasum -a 256 camkit-*.tar.gz > checksums.txt
cat checksums.txt
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.v.outputs.tag }}
run: |
# Anchor release notes to the last published release, not the
# previous git tag, so a failed release run can't swallow commits.
PREV=$(gh release list --exclude-drafts --exclude-pre-releases --limit 1 --json tagName -q '.[0].tagName' || true)
NOTES_ARGS=(--generate-notes)
if [ -n "$PREV" ] && [ "$PREV" != "$TAG" ]; then
NOTES_ARGS+=(--notes-start-tag "$PREV")
fi
cp scripts/install.sh dist/install.sh
gh release create "$TAG" \
--title "$TAG" \
"${NOTES_ARGS[@]}" \
dist/camkit-*.tar.gz \
dist/checksums.txt \
dist/install.sh