-
Notifications
You must be signed in to change notification settings - Fork 4
111 lines (95 loc) · 3.4 KB
/
Copy pathrelease.yml
File metadata and controls
111 lines (95 loc) · 3.4 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
name: release
# Publishes the tsforge CLI to npm and creates a GitHub Release when a
# semver tag v*.*.* is pushed. Version in packages/core/package.json
# must match the tag (without the leading v).
on:
push:
tags: ["v*.*.*"]
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
id-token: write
jobs:
publish:
name: npm publish + GitHub Release
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # full history + tags so release notes can diff since the previous tag
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.14
- name: Cache bun install
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install ripgrep
run: sudo apt-get update && sudo apt-get install -y ripgrep
- name: Set up Node for npm
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Verify tag matches package version
id: version
run: |
TAG="${GITHUB_REF_NAME#v}"
PKG_VERSION=$(jq -r '.version' packages/core/package.json)
if [ "$TAG" != "$PKG_VERSION" ]; then
echo "Tag v${TAG} does not match packages/core/package.json version ${PKG_VERSION}."
exit 1
fi
echo "version=${PKG_VERSION}" >> "$GITHUB_OUTPUT"
echo "Publishing @agjs/tsforge@${PKG_VERSION}"
- name: Validate
run: bun run validate
- name: Publish to npm
working-directory: packages/core
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm whoami
npm publish --access public --provenance
- name: Build release notes
id: notes
run: |
set +e
PREV_TAG=$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}^" 2>/dev/null)
{
echo "## What's changed"
echo
if [ -n "$PREV_TAG" ]; then
echo "Since ${PREV_TAG}:"
echo
RANGE="${PREV_TAG}..${GITHUB_REF_NAME}"
else
RANGE="${GITHUB_REF_NAME}"
fi
# Drop the version-bump commit — it's noise in the changelog.
git log --no-merges --pretty='- %s' "$RANGE" | { grep -vE '^- chore: release ' || true; }
echo
echo "## Install"
echo
echo '```bash'
echo "bun install -g @agjs/tsforge@${{ steps.version.outputs.version }}"
echo '```'
echo
echo "Or: \`curl -fsSL https://tsforge.dev/install.sh | bash\`"
} > RELEASE_NOTES.md
cat RELEASE_NOTES.md
exit 0
- name: Create GitHub Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
body_path: RELEASE_NOTES.md