-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (69 loc) · 2.29 KB
/
changesets.yml
File metadata and controls
82 lines (69 loc) · 2.29 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: Changesets
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
pull-requests: write
jobs:
release:
name: Release
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build binaries
run: bun run build
- name: Create Release Pull Request or Build
id: changesets
uses: changesets/action@v1
with:
version: bun run version
publish: bun run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get version from package.json
if: steps.changesets.outputs.hasChangesets == 'false'
id: version
run: echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
- name: Extract changelog for version
if: steps.changesets.outputs.hasChangesets == 'false'
id: changelog
run: |
VERSION="${{ steps.version.outputs.version }}"
# Extract changelog section for this version
# Match from "## X.Y.Z" until the next "## " heading or end of file
CHANGELOG=$(awk -v ver="$VERSION" '
BEGIN { found=0; output="" }
/^## / {
if (found) exit
if ($2 == ver) { found=1; next }
}
found { output = output $0 "\n" }
END { print output }
' CHANGELOG.md)
# Trim trailing whitespace
CHANGELOG=$(echo "$CHANGELOG" | sed -e 's/[[:space:]]*$//')
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
if: steps.changesets.outputs.hasChangesets == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
body: ${{ steps.changelog.outputs.notes }}
files: |
dist/ralph-darwin-arm64
dist/ralph-darwin-x64
dist/ralph-linux-arm64
dist/ralph-linux-x64