Skip to content

Commit 88a9712

Browse files
ci: simplify npm authentication using NODE_AUTH_TOKEN env variable
1 parent 2e4115d commit 88a9712

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

.github/workflows/sdk-deprecate-npm.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ jobs:
2222
node-version: '18'
2323
registry-url: 'https://registry.npmjs.org'
2424

25-
- name: Authenticate to npm
26-
run: |
27-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
28-
echo "Registry URL: https://registry.npmjs.org"
29-
echo "Auth token configured"
30-
3125
- name: Check if package version exists
3226
working-directory: packages/sdk
3327
run: |
@@ -41,13 +35,10 @@ jobs:
4135
exit 1
4236
fi
4337
44-
- name: Verify authentication
45-
run: |
46-
echo "Verifying npm authentication..."
47-
npm whoami
48-
4938
- name: Deprecate package
5039
working-directory: packages/sdk
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5142
run: |
5243
if [ -n "${{ github.event.inputs.package_version }}" ]; then
5344
echo "Deprecating @iexec/dataprotector@${{ github.event.inputs.package_version }}"

.github/workflows/sdk-undeprecate-npm.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,36 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
18-
18+
1919
- name: Set up Node.js
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: '18'
2323
registry-url: 'https://registry.npmjs.org'
24-
25-
- name: Authenticate to npm
26-
run: |
27-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
28-
24+
2925
- name: Check if package version exists
3026
working-directory: packages/sdk
3127
run: |
3228
echo "Checking if version ${{ github.event.inputs.package_version }} exists..."
3329
if npm view @iexec/dataprotector@${{ github.event.inputs.package_version }} version > /dev/null 2>&1; then
34-
echo "Version ${{ github.event.inputs.package_version }} exists in registry"
30+
echo "Version ${{ github.event.inputs.package_version }} exists in registry"
3531
else
36-
echo "Version ${{ github.event.inputs.package_version }} does not exist in registry"
37-
echo "This might be a nightly/staging version that was never published to the public registry."
32+
echo "❌ Version ${{ github.event.inputs.package_version }} does not exist in registry"
3833
echo "Available versions:"
3934
npm view @iexec/dataprotector versions --json | tail -10
4035
exit 1
4136
fi
42-
37+
4338
- name: Undeprecate package
4439
working-directory: packages/sdk
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4542
run: |
4643
if [ -n "${{ github.event.inputs.package_version }}" ]; then
4744
echo "Removing deprecation from @iexec/dataprotector@${{ github.event.inputs.package_version }}"
4845
npm deprecate @iexec/dataprotector@${{ github.event.inputs.package_version }} ""
49-
echo "Successfully removed deprecation from version ${{ github.event.inputs.package_version }}"
46+
echo "Successfully removed deprecation from version ${{ github.event.inputs.package_version }}"
5047
else
51-
echo "Package version is not set"
48+
echo "Package version is not set"
5249
exit 1
5350
fi

0 commit comments

Comments
 (0)