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

Fix NPM Publish #33

Merged
merged 5 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
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
79 changes: 40 additions & 39 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- 'package.json'
- "package.json"

concurrency: ${{ github.workflow }}-${{ github.ref }}

Expand All @@ -18,44 +18,45 @@ jobs:
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get version from package.json
id: package_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

- name: Check if tag exists
id: check_tag
run: |
git fetch --tags
if git rev-parse "v${{ steps.package_version.outputs.VERSION }}" >/dev/null 2>&1; then
echo "::set-output name=EXISTS::true"
fi

- name: Create Release
if: steps.check_tag.outputs.EXISTS != 'true'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.package_version.outputs.VERSION }}
name: Release v${{ steps.package_version.outputs.VERSION }}
draft: false
prerelease: false
generate_release_notes: true
make_latest: true

- name: Setup node
uses: actions/setup-node@v4
with:
- name: Checkout code
uses: actions/checkout@v4

- name: Get version from package.json
id: package_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

- name: Check if tag exists
id: check_tag
run: |
git fetch --tags
if git rev-parse "v${{ steps.package_version.outputs.VERSION }}" >/dev/null 2>&1; then
echo "::set-output name=EXISTS::true"
fi

- name: Create Release
if: steps.check_tag.outputs.EXISTS != 'true'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.package_version.outputs.VERSION }}
name: Release v${{ steps.package_version.outputs.VERSION }}
draft: false
prerelease: false
generate_release_notes: true
make_latest: true

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Publish to NPM
run: |
npm install -g npm@^9.5.0
npm ci
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to NPM
if: steps.check_tag.outputs.EXISTS != 'true'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is the fix.

run: |
npm install -g npm@^9.5.0
npm ci
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coinbase/staking-client-library-ts",
"version": "0.7.1",
"version": "0.8.1",
"description": "Coinbase Staking API Typescript Library",
"repository": "https://github.com/coinbase/staking-client-library-ts.git",
"license": "Apache-2.0",
Expand Down
Loading