Skip to content
Merged
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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ci
Copy link
Copy Markdown
Contributor

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


on: [push]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The setup-node action is missing the node-version parameter. This could lead to inconsistent builds if GitHub Actions' default Node.js version changes. Consider specifying a version like:

Suggested change
- uses: actions/setup-node@v6
- uses: actions/setup-node@v6
with:
node-version: '18'

- 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
- uses: actions/setup-node@v6
- uses: actions/setup-node@v6
with:
node-version: '18'

- run: npm ci
- run: npm run build
- name: Publish to npm
Comment on lines +23 to +26
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 NODE_AUTH_TOKEN secret. Consider adding this to your setup-node action in the publish job:

Suggested change
- uses: actions/setup-node@v6
- run: npm ci
- run: npm run build
- name: Publish to npm
- uses: actions/setup-node@v6
with:
registry-url: 'https://registry.npmjs.org'

And then add the NODE_AUTH_TOKEN to your publish step:

Suggested change
- uses: actions/setup-node@v6
- run: npm ci
- run: npm run build
- name: Publish to npm
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 to this do we have these secrets set up?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The 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