Skip to content

Commit 709578b

Browse files
authored
Update npm-publish.yml
1 parent 1d9186e commit 709578b

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313

14-
# pnpm d'abord si on veut cache: pnpm ensuite
14+
# Installer pnpm avant d'activer cache: pnpm
1515
- uses: pnpm/action-setup@v3
1616
with:
1717
version: 9.12.2
@@ -29,6 +29,7 @@ jobs:
2929
- name: Type Check
3030
run: pnpm exec tsc --noEmit
3131

32+
3233
publish-npm:
3334
needs: build
3435
runs-on: ubuntu-latest
@@ -45,11 +46,24 @@ jobs:
4546
node-version: 20
4647
registry-url: https://registry.npmjs.org/
4748

49+
# Auth + conf dans le .npmrc utilisé par setup-node (NPM_CONFIG_USERCONFIG)
50+
- name: Configure npm auth and pnpm publish settings
51+
run: |
52+
# Auth npmjs
53+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > "$NPM_CONFIG_USERCONFIG"
54+
# Eviter les vérifs git/branche pendant pnpm publish
55+
echo "git-checks=false" >> "$NPM_CONFIG_USERCONFIG"
56+
echo "publish-branch=V4" >> "$NPM_CONFIG_USERCONFIG"
57+
env:
58+
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
59+
4860
- run: pnpm -v
49-
- run: pnpm publish --no-interactive --no-git-checks --publish-branch V4
61+
# Pas d'options inconnues : pnpm ne supporte pas --yes/--no-interactive
62+
- run: pnpm publish --no-git-checks --publish-branch V4 --access public
5063
env:
5164
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
5265

66+
5367
publish-github-packages:
5468
needs: build
5569
runs-on: ubuntu-latest
@@ -65,17 +79,20 @@ jobs:
6579
with:
6680
node-version: 20
6781
registry-url: https://npm.pkg.github.com
68-
scope: '@baba33mrt' # <-- adapte au scope du package
82+
scope: '@baba33mrt' # <-- adapte au scope de ton package (ex: "@org/nom")
6983

70-
# Écrire la conf dans le fichier .npmrc que setup-node utilise (NPM_CONFIG_USERCONFIG)
71-
- name: Auth to GitHub Packages
84+
# Auth + conf dans le .npmrc du job (NPM_CONFIG_USERCONFIG)
85+
- name: Configure GPR auth and pnpm publish settings
7286
run: |
87+
# Auth GitHub Packages
7388
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN_GPKG}" > "$NPM_CONFIG_USERCONFIG"
74-
echo "always-auth=true" >> "$NPM_CONFIG_USERCONFIG"
89+
# Eviter les vérifs git/branche pendant pnpm publish
90+
echo "git-checks=false" >> "$NPM_CONFIG_USERCONFIG"
91+
echo "publish-branch=V4" >> "$NPM_CONFIG_USERCONFIG"
7592
env:
7693
NODE_AUTH_TOKEN_GPKG: ${{ secrets.NODE_AUTH_TOKEN_GPKG }}
7794

7895
- run: pnpm -v
79-
- run: pnpm publish --no-interactive --no-git-checks --publish-branch V4
96+
- run: pnpm publish --no-git-checks --publish-branch V4
8097
env:
8198
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN_GPKG }}

0 commit comments

Comments
 (0)