-
Notifications
You must be signed in to change notification settings - Fork 30
fix: npm publish workflow #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Senseye
wants to merge
7
commits into
master
Choose a base branch
from
fix/npm-publish
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
324c756
fix: npm publish workflow
3fb026d
publish workflow
9e7d005
chore: track package-lock.json for reproducible installs
3d737ba
fix: regenerate package-lock.json against the public npm registry
04b0cb6
ci: mark test-optional job as continue-on-error
0ef57a1
fix(ci): move continue-on-error to step level in test-optional
79077e5
chore(ci): bump release-please-action to v5
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: npm-publish | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: npm-publish-${{ github.event.release.tag_name || github.run_id }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| validate: | ||
| name: Validate | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name || github.ref }} | ||
| persist-credentials: false | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do in this context? I don't think I have ever seen this be necessary, so just want to make sure I understand why it is here. |
||
|
|
||
| - uses: actions/setup-node@v7 | ||
| with: | ||
| node-version: 22.x | ||
|
|
||
| - name: verify release version | ||
| if: github.event_name == 'release' | ||
| run: | | ||
| pkg_name=$(jq -r .name package.json) | ||
| pkg_version=$(jq -r .version package.json) | ||
| tag_version="${GITHUB_EVENT_RELEASE_TAG_NAME#v}" | ||
| if [ "$pkg_version" != "$tag_version" ]; then | ||
| echo "package.json version ($pkg_version) does not match release tag ($tag_version)" | ||
| exit 1 | ||
| fi | ||
| if npm view "${pkg_name}@${pkg_version}" version >/dev/null 2>&1; then | ||
| echo "${pkg_name}@${pkg_version} is already published" | ||
| exit 1 | ||
| fi | ||
| env: | ||
| GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} | ||
|
|
||
| - name: validate publish package contents | ||
| run: | | ||
| npm pack --dry-run 2>&1 | tee pack.log | ||
| grep -q 'lib/' pack.log | ||
| ! grep -qE '[[:space:]]test/' pack.log | ||
| ! grep -qE '[[:space:]]tools/' pack.log | ||
|
|
||
| publish: | ||
| name: publish | ||
| needs: validate | ||
| if: github.event_name == 'release' | ||
| runs-on: ubuntu-latest | ||
| environment: Publish | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name }} | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-node@v7 | ||
| with: | ||
| node-version: 22.x | ||
| registry-url: https://registry.npmjs.org | ||
|
|
||
| - name: publish to npm | ||
| run: npm publish --provenance | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| name: release-please | ||
| permissions: | ||
| contents: write | ||
| issues: write | ||
| pull-requests: write | ||
| jobs: | ||
| release-please: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: googleapis/release-please-action@v5 | ||
| with: | ||
| release-type: node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,6 @@ Thumbs.db | |
|
|
||
| /node_modules/ | ||
| npm-debug.log | ||
| package-lock.json | ||
| yarn.lock | ||
|
|
||
| # build task results for ci | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth a comment on why we want these settings here. While I agree with it for the
tag_namecase, the fallback torun_idseems odd so I want to make sure I understand the goal.