Skip to content

Commit f927d9a

Browse files
authored
Merge pull request #186 from SolidOS/update-publish-workflow
update publish workflow
2 parents 2c5662b + e278cb2 commit f927d9a

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

44
name: CI
5-
permissions:
6-
contents: write
7-
pull-requests: write
5+
86
on:
97
push:
108
branches:
@@ -60,39 +58,47 @@ jobs:
6058
npm-publish-build:
6159
needs: build
6260
runs-on: ubuntu-latest
61+
permissions:
62+
id-token: write # Required for OIDC
63+
contents: read
6364
steps:
6465
- uses: actions/download-artifact@v7
6566
with:
6667
name: build
6768
- uses: actions/setup-node@v6
6869
with:
6970
node-version: 20.x
71+
registry-url: 'https://registry.npmjs.org'
72+
- name: Update npm to latest (required for OIDC)
73+
run: npm install -g npm@latest
7074
- uses: rlespinasse/github-slug-action@v4.x
7175
- name: Append commit hash to package version
7276
run: 'sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
7377
- name: Disable pre- and post-publish actions
7478
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
75-
- uses: JS-DevTools/npm-publish@v4.1.4
79+
- name: Publish to npm
7680
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
77-
with:
78-
token: ${{ secrets.NPM_TOKEN }}
79-
tag: ${{ env.GITHUB_REF_SLUG }}
81+
run: npm publish --tag ${{ env.GITHUB_REF_SLUG }}
8082

8183
npm-publish-latest:
8284
needs: [build, npm-publish-build]
8385
runs-on: ubuntu-latest
8486
if: github.ref == 'refs/heads/main'
87+
permissions:
88+
id-token: write # Required for OIDC
89+
contents: read
8590
steps:
8691
- uses: actions/download-artifact@v7
8792
with:
8893
name: build
8994
- uses: actions/setup-node@v6
9095
with:
9196
node-version: 20.x
97+
registry-url: 'https://registry.npmjs.org'
98+
- name: Update npm to latest (required for OIDC)
99+
run: npm install -g npm@latest
92100
- name: Disable pre- and post-publish actions
93101
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
94-
- uses: JS-DevTools/npm-publish@v4.1.4
102+
- name: Publish to npm
95103
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
96-
with:
97-
token: ${{ secrets.NPM_TOKEN }}
98-
tag: latest
104+
run: npm publish --tag latest

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"repository": {
4141
"type": "git",
42-
"url": "git+https://github.com/solidos/solid-logic.git"
42+
"url": "git+https://github.com/SolidOS/solid-logic.git"
4343
},
4444
"author": "",
4545
"license": "MIT",

0 commit comments

Comments
 (0)