Skip to content
Merged
Changes from 3 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
31 changes: 10 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Update npm
run: sudo npm install -g npm@latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

strongly recommend pinning this to a specific version and regularly updating so we don't fall prey to supply chain attacks if npm gets hacked

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cellog good call I just copied over the fern recommendation for the CI

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

yeah I saw that in the docs, no worries.

side note: that, in a nutshell, is why AI makes so many questionable recommendations: the official docs often make questionable recommendations and it was trained on that stuff 😂.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So true haha updated now!


- name: Compile
run: pnpm build

Expand Down Expand Up @@ -67,24 +70,10 @@ jobs:

- name: Publish to npm
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
publish() { # use latest npm to ensure OIDC support
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
PKG_NAME=$(node -p "require('./package.json').name")
PKG_VERSION=$(node -p "require('./package.json').version")
CURRENT_LATEST=$(npm view "${PKG_NAME}" dist-tags.latest 2>/dev/null || echo "0.0.0")
if npx -y semver "${PKG_VERSION}" -r "<${CURRENT_LATEST}" > /dev/null 2>&1; then
echo "Publishing ${PKG_VERSION} with --tag backport (current latest is ${CURRENT_LATEST})"
publish --access public --tag backport
else
publish --access public
fi
fi
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
if [[ ${GITHUB_REF} == *alpha* ]]; then
npm publish --access public --tag alpha
elif [[ ${GITHUB_REF} == *beta* ]]; then
npm publish --access public --tag beta
else
npm publish --access public
fi
Loading