Skip to content
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

ci: publish to npm fix #57

Merged
merged 1 commit into from
Oct 21, 2024
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
26 changes: 13 additions & 13 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ jobs:
solana-cli-version: '1.18.15'
node-version: '21.0.0'

- name: Setup Node.js for NPM Publish
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '21.0.0'
registry-url: 'https://registry.npmjs.org'
auth-token: ${{ secrets.NPM_TOKEN }}
node-version: "21"
registry-url: "https://registry.npmjs.org"

- name: Build
run: anchor build
Expand All @@ -38,18 +37,19 @@ jobs:
- name: Determine NPM Tag
id: determine-npm-tag
run: |
VERSION_TAG=${{ github.ref_name }}
VERSION_TAG=${GITHUB_REF#refs/tags/v}
if [[ $VERSION_TAG == *"-"* ]]; then
NPM_TAG=${VERSION_TAG#*-}
echo ::set-output name=NPM_TAG::${VERSION_TAG#*-}
else
NPM_TAG=latest
echo ::set-output name=NPM_TAG::latest
fi
echo "NPM_TAG=$NPM_TAG" >> "$GITHUB_OUTPUT"
env:
GITHUB_REF: ${{ github.ref }}

- name: Publish to NPM
run: |
yarn publish \
--access public \
--new-version "${{ github.ref_name }}" \
--tag "${{ steps.determine-npm-tag.outputs.NPM_TAG }}" \
--no-git-tag-version
yarn publish --access public --new-version ${GITHUB_REF#refs/tags/v} --tag ${{
steps.determine-npm-tag.outputs.NPM_TAG }} --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_REF: ${{ github.ref }}
Loading