Skip to content

Commit 9291433

Browse files
authored
refactor: introduce trusted publishing (#3161)
* refactor: introduce trusted publishing * Remove NPM_TOKEN from publish workflow Removed NPM_TOKEN from the workflow for security reasons. * Update .nvmrc * Update publish-release.yml * Update package.json * Update publish-npm.sh
1 parent 48338e9 commit 9291433

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.github/scripts/publish-npm.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,14 @@ do
5151
echo "🔑 Authenticated with GITHUB"
5252
elif [[ $REGISTRY == 'NPM' ]]; then
5353
npm config set @db-ui:registry https://registry.npmjs.org/
54-
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
5554
echo "🔑 Authenticated with NPM"
5655
else
5756
echo "Could not authenticate with $REGISTRY"
5857
exit 1
5958
fi
6059
# https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow
61-
npm publish --tag "$TAG" db-ui-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --provenance
62-
npm publish --tag "$TAG" db-ui-ngx-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --provenance
63-
npm publish --tag "$TAG" db-ui-react-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --provenance
64-
npm publish --tag "$TAG" db-ui-v-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --provenance
60+
npm publish --tag "$TAG" db-ui-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz
61+
npm publish --tag "$TAG" db-ui-ngx-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz
62+
npm publish --tag "$TAG" db-ui-react-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz
63+
npm publish --tag "$TAG" db-ui-v-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz
6564
done

.github/workflows/03-publish-packages.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ jobs:
8080
VALID_SEMVER_VERSION: ${{ inputs.version }}
8181
DBUI_THEME: ${{ matrix.themes }}
8282
PACKAGE_ENDING: ${{ steps.getPkgTheme.outputs.pkgTheme }}
83-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8483
GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8584

8685
- name: ⬆ Upload Package Artifact elements-${{ matrix.themes }}

.github/workflows/publish-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
uses: ./.github/workflows/03-publish-packages.yml
5454
needs: [cypress, get-publish-version]
5555
secrets: inherit
56+
permissions:
57+
id-token: write # Required for OIDC
5658
with:
5759
release: ${{ needs.get-publish-version.outputs.release }}
5860
preRelease: ${{ needs.get-publish-version.outputs.preRelease }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22
1+
24

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"registry": "https://registry.npmjs.org/"
7575
},
7676
"homepage": "https://db-ui.github.io/elements/",
77-
"packageManager": "npm@10.9.2",
77+
"packageManager": "npm@11.6.1",
7878
"optionalDependencies": {
7979
"sass-embedded-linux-x64": "1.93.3"
8080
}

0 commit comments

Comments
 (0)