Skip to content

Commit 2475d8a

Browse files
committed
Test out this new fangled trusted publishing thing
1 parent 5b53ab1 commit 2475d8a

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,45 @@ jobs:
3030
POSTHOG_PERF_API_KEY: ${{ secrets.POSTHOG_PERF_API_KEY }}
3131

3232
- name: Deploy docs
33-
if: github.ref == 'refs/heads/main' && matrix.node-version == 'v22.14.0'
33+
if: github.ref == 'refs/heads/main' && matrix.node-version == 'v22.20.0'
3434
uses: JamesIves/github-pages-deploy-action@v4
3535
with:
3636
single-commit: true
3737
branch: gh-pages
3838
folder: typedoc
3939

40+
publish:
41+
name: Publish to npm
42+
needs: build
43+
if: startsWith(github.ref, 'refs/tags/v')
44+
runs-on: ubuntu-latest
45+
environment:
46+
name: npm
47+
url: https://www.npmjs.com/package/mockttp
48+
permissions:
49+
contents: read
50+
id-token: write
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- uses: actions/setup-node@v4
56+
with:
57+
node-version: 'v22.20.0'
58+
registry-url: 'https://registry.npmjs.org'
59+
cache: 'npm'
60+
61+
- run: npm ci
62+
63+
- name: Verify tag matches package.json version
64+
run: |
65+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
66+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
67+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
68+
echo "Error: Tag version (v$TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
69+
exit 1
70+
fi
71+
echo "✓ Tag version matches package.json version: $PACKAGE_VERSION"
72+
73+
- run: npm publish
74+

0 commit comments

Comments
 (0)