Skip to content

Commit 02e0b74

Browse files
author
Test User
committed
fix: correct GoReleaser version parameter in release workflow
The 'version' parameter in goreleaser-action specifies which version of GoReleaser to use, not the Git tag. The Git tag is automatically detected from the GitHub context when triggered by a tag push. Changed from: version: ${{ github.ref }} Changed to: version: latest This fixes the error: Cannot find GoReleaser release refs/tags/v1.0.0 in releases.json
1 parent e7e95aa commit 02e0b74

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ permissions:
99
contents: write
1010
pull-requests: write
1111

12+
env:
13+
NODE_VERSION: '20'
14+
1215
jobs:
1316
release:
1417
runs-on: ubuntu-latest
@@ -49,3 +52,47 @@ jobs:
4952
echo "Note: Homebrew formula not generated (tap repository may not exist yet)"
5053
fi
5154
55+
publish-npm:
56+
name: Publish to npm
57+
runs-on: ubuntu-latest
58+
needs: release
59+
if: startsWith(github.ref, 'refs/tags/v')
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
63+
with:
64+
fetch-depth: 0
65+
66+
- name: Set up Node.js
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: ${{ env.NODE_VERSION }}
70+
registry-url: 'https://registry.npmjs.org'
71+
72+
- name: Extract version from tag
73+
id: get_version
74+
run: |
75+
VERSION=${GITHUB_REF#refs/tags/v}
76+
echo "version=$VERSION" >> $GITHUB_OUTPUT
77+
echo "Publishing version: $VERSION"
78+
79+
- name: Update package.json version
80+
run: |
81+
npm version ${{ steps.get_version.outputs.version }} --no-git-tag-version
82+
83+
- name: Verify package.json
84+
run: |
85+
cat package.json | grep -A 2 '"version"'
86+
npm run prepublishOnly
87+
88+
- name: Publish to npm
89+
run: npm publish
90+
env:
91+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
92+
93+
- name: Verify npm publication
94+
run: |
95+
echo "Published to npm successfully!"
96+
echo "Package: doplan-cli@${{ steps.get_version.outputs.version }}"
97+
echo "npm URL: https://www.npmjs.com/package/doplan-cli"
98+

0 commit comments

Comments
 (0)