Skip to content

Commit 4579661

Browse files
fix(release): require npm 11.5.1 and publish before release (#5)
1 parent 70822e8 commit 4579661

1 file changed

Lines changed: 32 additions & 25 deletions

File tree

.github/workflows/publish.yml

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,20 @@ jobs:
6161
echo "exists=false" >> "$GITHUB_OUTPUT"
6262
fi
6363
64-
- name: Create and push git tag
65-
if: steps.check-version.outputs.exists == 'false'
66-
run: |
67-
VERSION="${{ steps.version.outputs.version }}"
68-
if ! git rev-parse "v$VERSION" >/dev/null 2>&1; then
69-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
70-
git config --local user.name "github-actions[bot]"
71-
git tag -a "v$VERSION" -m "Release v$VERSION"
72-
git push origin "v$VERSION"
73-
else
74-
echo "Tag v$VERSION already exists, skipping"
75-
fi
76-
7764
- name: Setup Node.js
7865
if: steps.check-version.outputs.exists == 'false'
7966
uses: actions/setup-node@v4
8067
with:
8168
node-version: "22.14.0"
8269
registry-url: "https://registry.npmjs.org"
8370

71+
- name: Ensure npm version for trusted publishing
72+
if: steps.check-version.outputs.exists == 'false'
73+
run: |
74+
npm install -g npm@11.5.1
75+
echo "Node: $(node --version)"
76+
echo "npm: $(npm --version)"
77+
8478
- name: Setup Bun
8579
if: steps.check-version.outputs.exists == 'false'
8680
uses: oven-sh/setup-bun@v2
@@ -91,18 +85,6 @@ jobs:
9185
if: steps.check-version.outputs.exists == 'false'
9286
run: bun install --frozen-lockfile
9387

94-
- name: Create GitHub Release
95-
if: steps.check-version.outputs.exists == 'false'
96-
run: |
97-
VERSION="${{ steps.version.outputs.version }}"
98-
if ! gh release view "v$VERSION" >/dev/null 2>&1; then
99-
bunx changelogithub
100-
else
101-
echo "Release v$VERSION already exists, skipping"
102-
fi
103-
env:
104-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105-
10688
- name: Typecheck
10789
if: steps.check-version.outputs.exists == 'false'
10890
run: bun run typecheck
@@ -115,6 +97,31 @@ jobs:
11597
if: steps.check-version.outputs.exists == 'false'
11698
run: npm publish --access public
11799

100+
- name: Create and push git tag
101+
if: steps.check-version.outputs.exists == 'false'
102+
run: |
103+
VERSION="${{ steps.version.outputs.version }}"
104+
if ! git rev-parse "v$VERSION" >/dev/null 2>&1; then
105+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
106+
git config --local user.name "github-actions[bot]"
107+
git tag -a "v$VERSION" -m "Release v$VERSION"
108+
git push origin "v$VERSION"
109+
else
110+
echo "Tag v$VERSION already exists, skipping"
111+
fi
112+
113+
- name: Create GitHub Release
114+
if: steps.check-version.outputs.exists == 'false'
115+
run: |
116+
VERSION="${{ steps.version.outputs.version }}"
117+
if ! gh release view "v$VERSION" >/dev/null 2>&1; then
118+
bunx changelogithub
119+
else
120+
echo "Release v$VERSION already exists, skipping"
121+
fi
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
118125
- name: Release summary
119126
if: steps.check-version.outputs.exists == 'false'
120127
run: |

0 commit comments

Comments
 (0)