Skip to content

Commit 1aa357a

Browse files
ci: migrate SDK npm deprecate/undeprecate from Drone to GitHub Actions (#516)
* ci: remove sdk deprecate npm version pipeline from drone * ci: remove sdk undeprecate npm version pipeline from drone * ci: add GitHub Actions workflows for SDK npm package deprecate/undeprecate * ci: add version validation to SDK npm deprecate/undeprecate workflows * ci: add authentication verification to SDK deprecate workflow * ci: simplify npm authentication using NODE_AUTH_TOKEN env variable * ci: update deprecate message Co-authored-by: pjt <[email protected]> --------- Co-authored-by: pjt <[email protected]>
1 parent 95973ff commit 1aa357a

File tree

3 files changed

+100
-56
lines changed

3 files changed

+100
-56
lines changed

.drone.yml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -121,59 +121,3 @@ steps:
121121
depends_on:
122122
- smart-contract-staging-upgrade
123123
# - smart-contract-prod-upgrade
124-
125-
---
126-
kind: pipeline
127-
type: docker
128-
name: sdk deprecate npm version
129-
130-
trigger:
131-
event:
132-
- promote
133-
target:
134-
# deprecates a version of @iexec/dataprotector
135-
- sdk-deprecate-package
136-
137-
steps:
138-
- name: authenticate
139-
image: robertstettner/drone-npm-auth
140-
settings:
141-
username:
142-
from_secret: npm_username
143-
token:
144-
from_secret: npm_token
145-
146-
- name: deprecate package
147-
image: node:18.19
148-
params:
149-
- PACKAGE_VERSION
150-
commands:
151-
- if [ -n "$PACKAGE_VERSION" ]; then npm deprecate @iexec/dataprotector@$PACKAGE_VERSION "deprecate $PACKAGE_VERSION"; else echo "PACKAGE_VERSION is not set"; fi
152-
153-
---
154-
kind: pipeline
155-
type: docker
156-
name: sdk undeprecate npm version
157-
158-
trigger:
159-
event:
160-
- promote
161-
target:
162-
# remove the deprecation of a version of @iexec/dataprotector
163-
- sdk-undeprecate-package
164-
165-
steps:
166-
- name: authenticate
167-
image: robertstettner/drone-npm-auth
168-
settings:
169-
username:
170-
from_secret: npm_username
171-
token:
172-
from_secret: npm_token
173-
174-
- name: undeprecate package
175-
image: node:18.19
176-
params:
177-
- PACKAGE_VERSION
178-
commands:
179-
- if [ -n "$PACKAGE_VERSION" ]; then npm deprecate @iexec/dataprotector@$PACKAGE_VERSION ""; else echo "PACKAGE_VERSION is not set"; fi
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: SDK - Deprecate NPM Package
2+
description: Deprecate a version of @iexec/dataprotector
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
package_version:
8+
description: 'Package version to deprecate (e.g., 1.0.0)'
9+
required: true
10+
type: string
11+
12+
jobs:
13+
deprecate-package:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Check if package version exists
26+
working-directory: packages/sdk
27+
run: |
28+
echo "Checking if version ${{ github.event.inputs.package_version }} exists..."
29+
if npm view @iexec/dataprotector@${{ github.event.inputs.package_version }} version > /dev/null 2>&1; then
30+
echo "✅ Version ${{ github.event.inputs.package_version }} exists in registry"
31+
else
32+
echo "❌ Version ${{ github.event.inputs.package_version }} does not exist in registry"
33+
echo "Available versions:"
34+
npm view @iexec/dataprotector versions --json | tail -10
35+
exit 1
36+
fi
37+
38+
- name: Deprecate package
39+
working-directory: packages/sdk
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
run: |
43+
if [ -n "${{ github.event.inputs.package_version }}" ]; then
44+
echo "Deprecating @iexec/dataprotector@${{ github.event.inputs.package_version }}"
45+
npm deprecate @iexec/dataprotector@${{ github.event.inputs.package_version }} "This version is no longer supported"
46+
echo "✅ Successfully deprecated version ${{ github.event.inputs.package_version }}"
47+
else
48+
echo "❌ Package version is not set"
49+
exit 1
50+
fi
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: SDK - Undeprecate NPM Package
2+
description: Remove deprecation from a version of @iexec/dataprotector
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
package_version:
8+
description: 'Package version to undeprecate (e.g., 1.0.0)'
9+
required: true
10+
type: string
11+
12+
jobs:
13+
undeprecate-package:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Check if package version exists
26+
working-directory: packages/sdk
27+
run: |
28+
echo "Checking if version ${{ github.event.inputs.package_version }} exists..."
29+
if npm view @iexec/dataprotector@${{ github.event.inputs.package_version }} version > /dev/null 2>&1; then
30+
echo "✅ Version ${{ github.event.inputs.package_version }} exists in registry"
31+
else
32+
echo "❌ Version ${{ github.event.inputs.package_version }} does not exist in registry"
33+
echo "Available versions:"
34+
npm view @iexec/dataprotector versions --json | tail -10
35+
exit 1
36+
fi
37+
38+
- name: Undeprecate package
39+
working-directory: packages/sdk
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
run: |
43+
if [ -n "${{ github.event.inputs.package_version }}" ]; then
44+
echo "Removing deprecation from @iexec/dataprotector@${{ github.event.inputs.package_version }}"
45+
npm deprecate @iexec/dataprotector@${{ github.event.inputs.package_version }} ""
46+
echo "✅ Successfully removed deprecation from version ${{ github.event.inputs.package_version }}"
47+
else
48+
echo "❌ Package version is not set"
49+
exit 1
50+
fi

0 commit comments

Comments
 (0)