Skip to content

Commit ea0dfdb

Browse files
committed
ci: Switch to Trusted Publishing for NPM
See https://docs.npmjs.com/trusted-publishers
1 parent ca1f4e2 commit ea0dfdb

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

.github/npm-tag.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
case "$1" in
4+
*-rc*) echo tag=rc;;
5+
*-beta*) echo tag=beta;;
6+
*-alpha*) echo tag=alpha;;
7+
*) echo tag=latest;;
8+
esac
9+

.github/workflows/create-release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
push:
55
tags: ["v*"]
66

7+
permissions:
8+
id-token: write # Required for OIDC
9+
contents: read
10+
711
jobs:
812
build-matrix:
913
strategy:
@@ -56,6 +60,11 @@ jobs:
5660
- name: get-npm-version
5761
id: package-version
5862
run: jq -r '"version=" + .version' package.json >> "$GITHUB_OUTPUT"
63+
- name: get-npm-tag
64+
id: package-tag
65+
run: .github/npm-tag.sh $PACKAGE_VERSION >> "$GITHUB_OUTPUT"
66+
env:
67+
PACKAGE_VERSION: ${{ steps.package-version.outputs.version }}
5968
# Download all of the various binaries that were created
6069
- name: Download built binaries from workflow
6170
uses: actions/download-artifact@v5
@@ -75,6 +84,10 @@ jobs:
7584
files:
7685
./binaries/odbc-*.tar.gz
7786
- name: Publish to NPM
78-
uses: JS-DevTools/npm-publish@v3
87+
uses: actions/setup-node@v4
7988
with:
80-
token: ${{ secrets.NPM_TOKEN }}
89+
node-version: '24'
90+
registry-url: 'https://registry.npmjs.org'
91+
- run: npm publish --tag $PACKAGE_TAG
92+
env:
93+
PACKAGE_TAG: ${{ steps.package-tag.outputs.tag }}

0 commit comments

Comments
 (0)