-
Notifications
You must be signed in to change notification settings - Fork 32
69 lines (57 loc) · 1.98 KB
/
Copy pathrelease.yml
File metadata and controls
69 lines (57 loc) · 1.98 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
name: Release
on:
release:
types: [published]
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- name: Checkout release tag
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Verify tag matches package.json version
run: |
tag="${GITHUB_REF_NAME#v}"
pkg=$(node -p "require('./package.json').version")
if [ "$tag" != "$pkg" ]; then
echo "::error::Tag ${GITHUB_REF_NAME} (=$tag) does not match package.json version $pkg"
exit 1
fi
echo "Tag and package.json both at $pkg"
- name: Run tests
run: npm test
- name: Verify skills contract
run: npm run verify:skills
- name: Packs lock check (parity with PR CI)
run: npm run packs:check
- name: Packs vendor-sync check (parity with PR CI)
run: npm run packs:vendor:sync -- --check
- name: Mechanical score (banned openers, key-free)
run: npm run score:mechanical
# Prerelease (e.g. 5.0.0-rc.1) → npm dist-tag `rc` so `latest` stays on stable.
# Stable → default `latest` tag.
- name: Publish to npm
run: |
pkg=$(node -p "require('./package.json').version")
if node -e "process.exit(/-(rc|alpha|beta|pre)/i.test(process.argv[1])?0:1)" "$pkg"; then
echo "Publishing prerelease $pkg with dist-tag rc"
npm publish --access public --provenance --tag rc
else
echo "Publishing stable $pkg with dist-tag latest"
npm publish --access public --provenance
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}