-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (42 loc) · 1.57 KB
/
Copy pathrelease.yml
File metadata and controls
52 lines (42 loc) · 1.57 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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: read
# Required for npm provenance: the attestation is built from this workflow's
# OIDC claims, which is what lets npm show where the package was built.
id-token: write
jobs:
publish:
name: publish to npm
runs-on: ubuntu-latest
# A GitHub environment, so the token can be scoped to releases and the
# publish can be gated on a manual approval.
environment: npm-publish
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
cache: npm
- run: npm ci
# The tag is the only thing a human types during a release. An npm
# publish cannot be undone, so a mismatch has to fail here.
- name: Check the tag matches the package version
run: node scripts/check-release-version.mjs "${{ github.ref_name }}"
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm test
# The same check CI runs, reused as the release gate: it packs the
# tarball, installs it into a clean directory and runs the README
# example against it. Publishing something that fails this would be
# publishing something that does not work.
- name: Verify packaged install and README example
run: npm run verify:packaged
- name: Publish
run: npm publish --provenance --access public --workspace @masterplaycoding/eventlab
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}