Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Publishes rollbar-cli to npm when a GitHub release is published, using npm
# trusted publishing (OIDC). No NPM_TOKEN is needed: the matching trusted
# publisher on npmjs.com points at this workflow file (publish.yml).

name: Publish to npm

on:
release:
types: [published]

permissions:
id-token: write
contents: read

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'

# Trusted publishing requires npm 11.5.1 or later.
- run: npm install -g npm@^11.5.1

- name: Check package.json version matches release tag
id: version
env:
TAG: ${{ github.event.release.tag_name }}
run: |
VERSION=$(node -p "require('./package.json').version")
if [ "${TAG#v}" != "$VERSION" ]; then
echo "::error::package.json version ($VERSION) does not match release tag ($TAG)"
exit 1
fi
case "$VERSION" in
*-*) echo "dist_tag=next" >> "$GITHUB_OUTPUT" ;;
*) echo "dist_tag=latest" >> "$GITHUB_OUTPUT" ;;
esac

- run: npm ci
- run: npm run build --if-present
Comment thread
devtools-agent[bot] marked this conversation as resolved.
- run: npm test
- run: npm publish --provenance --access public --tag ${{ steps.version.outputs.dist_tag }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
package-lock.json
coverage
.nyc_output
.DS_Store
Expand Down
Loading
Loading