Skip to content

Commit 3c7a786

Browse files
committed
Fix publish CI configs
1 parent 3aa4ab5 commit 3c7a786

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/publish_release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
jobs:
1717
release-npm:
1818
runs-on: ubuntu-latest
19-
environment: main
19+
environment: npm
2020
permissions:
2121
contents: write
2222
id-token: write
@@ -27,6 +27,7 @@ jobs:
2727
uses: actions/setup-node@v4
2828
with:
2929
node-version: 22
30+
registry-url: 'https://registry.npmjs.org'
3031
- name: Restore cached dependencies
3132
uses: actions/cache@v4
3233
with:
@@ -40,17 +41,18 @@ jobs:
4041
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.PYTHON_NODE_NPM_TOKEN }}" > ~/.npmrc
4142
- name: Install dependencies
4243
run: pnpm install --frozen-lockfile
43-
- name: Bump version and push commit
44+
- name: Bump version and commit
4445
run: |
4546
pnpm version ${{ inputs.version }} --no-git-tag-version
4647
git config --global user.name "${{ github.actor }}"
4748
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
4849
git commit -a -m "Bumped v${{ inputs.version }}"
49-
git push origin HEAD:${{ github.ref }}
50-
- name: Publish new version
51-
run: |
52-
npm install npm -g
53-
npm publish --tag ${{ inputs.prerelease == true && 'next' || 'latest' }}
50+
- run: npm install -g npm@latest
51+
- run: npm publish --tag ${{ inputs.prerelease == true && 'next' || 'latest' }}
52+
env:
53+
GITHUB_TOKEN: ${{ github.token }}
54+
- name: Push release commit if publish succeeded
55+
run: git push origin HEAD:${{ github.ref }}
5456
- name: Create release notes
5557
run: |
5658
npx @matteo.collina/release-notes -a ${{ secrets.GITHUB_TOKEN }} -t v${{ inputs.version }} -r ${{ github.repository }} ${{ github.event.inputs.prerelease == 'true' && '-p' || '' }} -c ${{ github.ref }}

0 commit comments

Comments
 (0)