From 14d7d94b42298f8174b35de9593030854c9f7945 Mon Sep 17 00:00:00 2001 From: Sahil Sunny Date: Mon, 8 Dec 2025 14:08:10 +0530 Subject: [PATCH 1/2] Added Trusted Publisher Configuration --- .github/workflows/publish.yml | 42 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index db9a041..9b857ea 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,23 +1,29 @@ -name: npm publish +name: Publish Package on: - release: - types: [published] + push: + tags: + - 'v*' + +permissions: + id-token: write # Required for OIDC + contents: read jobs: - publish: - runs-on: ubuntu-latest + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14.x - uses: actions/setup-node@v4.4.0 - with: - node-version: 14.x - cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npm run build - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # Ensure npm 11.5.1 or later is installed + - name: Update npm + run: npm install -g npm@latest + - run: npm ci + - run: npm run build --if-present + - run: npm test + - run: npm publish \ No newline at end of file From 44a627e28b4948667fcc71975456c40423b06dc7 Mon Sep 17 00:00:00 2001 From: Sahil Sunny Date: Mon, 8 Dec 2025 14:31:17 +0530 Subject: [PATCH 2/2] Applying changes suggested by Etienne --- .github/workflows/publish.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9b857ea..db0947b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,8 @@ name: Publish Package on: - push: - tags: - - 'v*' + release: + types: [published] permissions: id-token: write # Required for OIDC @@ -13,11 +12,11 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6 with: - node-version: '20' + node-version: 14.x registry-url: 'https://registry.npmjs.org' # Ensure npm 11.5.1 or later is installed @@ -25,5 +24,4 @@ jobs: run: npm install -g npm@latest - run: npm ci - run: npm run build --if-present - - run: npm test - run: npm publish \ No newline at end of file