-
Notifications
You must be signed in to change notification settings - Fork 4
add publish workflow for this to publish to npm on tag creation #70
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,37 @@ | ||||||||||||||||||||||||||||||||
| name: ci | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| on: [push] | ||||||||||||||||||||||||||||||||
|
Contributor
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. should this only be on push to main? |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||
| compile: | ||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v6 | ||||||||||||||||||||||||||||||||
| - uses: actions/setup-node@v6 | ||||||||||||||||||||||||||||||||
|
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. The setup-node action is missing the
Suggested change
|
||||||||||||||||||||||||||||||||
| - run: npm ci | ||||||||||||||||||||||||||||||||
| - run: npm run build | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| publish: | ||||||||||||||||||||||||||||||||
| needs: [compile] | ||||||||||||||||||||||||||||||||
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v6 | ||||||||||||||||||||||||||||||||
| - uses: actions/setup-node@v6 | ||||||||||||||||||||||||||||||||
|
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. Similarly, the setup-node action in the publish job should specify a Node.js version for consistency:
Suggested change
|
||||||||||||||||||||||||||||||||
| - run: npm ci | ||||||||||||||||||||||||||||||||
| - run: npm run build | ||||||||||||||||||||||||||||||||
| - name: Publish to npm | ||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+26
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. The workflow is missing npm authentication configuration. To publish to npm, you need to set up authentication using the
Suggested change
And then add the NODE_AUTH_TOKEN to your publish step:
Suggested change
Contributor
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. +1 to this do we have these secrets set up?
Collaborator
Author
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. shouldn't be needed with OIDC |
||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| publish() { | ||||||||||||||||||||||||||||||||
| npx -y npm@latest publish "$@" | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| if [[ ${GITHUB_REF} == *alpha* ]]; then | ||||||||||||||||||||||||||||||||
| publish --access public --tag alpha | ||||||||||||||||||||||||||||||||
| elif [[ ${GITHUB_REF} == *beta* ]]; then | ||||||||||||||||||||||||||||||||
| publish --access public --tag beta | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| publish --access public | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
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.
nit shud we name this something else since its not in ci