Skip to content
Closed
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
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,49 @@ jobs:
run: npm run build
- name: Test
run: npx ava

release:
name: Release
if: github.event_name == 'push'
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
- name: Read the version
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
if npm view "@kikobeats/got@$VERSION" version > /dev/null 2>&1; then
echo "@kikobeats/got@$VERSION is already published"
else
echo "publish=true" >> "$GITHUB_OUTPUT"
fi
- name: Install dev dependencies
if: steps.version.outputs.publish == 'true'
run: npm install --ignore-scripts --before=$DEV_DEPENDENCIES_BEFORE
- name: Install latest runtime dependencies in range
if: steps.version.outputs.publish == 'true'
run: |
RUNTIME_DEPENDENCIES=$(node -p "Object.entries(require('./package.json').dependencies).map(([name, range]) => name + '@' + range).join(' ')")
npm install --ignore-scripts --no-save $RUNTIME_DEPENDENCIES pem@$PEM_VERSION @types/node@$TYPES_NODE_VERSION

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing token breaks release job

High Severity

setup-node with registry-url writes an .npmrc that interpolates NODE_AUTH_TOKEN, but the version check and install steps never set that variable. npm fails while expanding the config, so the already-published check always takes the publish path and install dies. Every push to v11 fails Release, and a new version cannot be published.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1c7c39e. Configure here.

- name: Publish
if: steps.version.outputs.publish == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access=public
- name: Tag and release
if: steps.version.outputs.publish == 'true'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
git tag "v$VERSION"
git push origin "v$VERSION"
gh release create "v$VERSION" --title "v$VERSION" --generate-notes