Skip to content

Commit dabd4e4

Browse files
committed
ci(sdk): publish npm sdk
1 parent b8b70d8 commit dabd4e4

File tree

2 files changed

+24
-166
lines changed

2 files changed

+24
-166
lines changed

.drone.yml

Lines changed: 0 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,172 +1206,6 @@ steps:
12061206
- protected-data-delivery-dapp-deploy-prod
12071207
- protected-data-delivery-dapp-deploy-staging
12081208

1209-
---
1210-
kind: pipeline
1211-
type: docker
1212-
name: sdk publish npm
1213-
1214-
trigger:
1215-
event:
1216-
- promote
1217-
target:
1218-
# publish the package @iexec/dataprotector on npm with the tag beta (require sdk version to be [version]-beta.[b])
1219-
- sdk-publish-beta
1220-
# publish the package @iexec/dataprotector on npm with the tag latest
1221-
- sdk-publish-latest
1222-
branch:
1223-
- main
1224-
1225-
steps:
1226-
- name: install
1227-
image: node:18.19
1228-
pull: always
1229-
commands:
1230-
- node -v
1231-
- npm -v
1232-
- cd packages/sdk
1233-
- npm ci
1234-
- npm run codegen
1235-
1236-
- name: build
1237-
image: node:18.19
1238-
commands:
1239-
- cd packages/sdk
1240-
- npm run build
1241-
depends_on:
1242-
- install
1243-
1244-
- name: check-beta-version
1245-
image: node:18.19
1246-
commands:
1247-
- cd packages/sdk
1248-
- npm pkg get version | grep "-beta."
1249-
when:
1250-
branch:
1251-
- main
1252-
target:
1253-
- sdk-publish-beta
1254-
1255-
- name: npm-publish-beta
1256-
image: plugins/npm
1257-
settings:
1258-
username:
1259-
from_secret: npm_username
1260-
token:
1261-
from_secret: npm_token
1262-
tag: beta
1263-
access: public
1264-
folder: packages/sdk
1265-
depends_on:
1266-
- build
1267-
- check-beta-version
1268-
when:
1269-
branch:
1270-
- main
1271-
target:
1272-
- sdk-publish-beta
1273-
1274-
- name: npm-publish-latest
1275-
image: plugins/npm
1276-
settings:
1277-
username:
1278-
from_secret: npm_username
1279-
token:
1280-
from_secret: npm_token
1281-
tag: latest
1282-
access: public
1283-
folder: packages/sdk
1284-
depends_on:
1285-
- build
1286-
when:
1287-
branch:
1288-
- main
1289-
target:
1290-
- sdk-publish-latest
1291-
1292-
- name: npm-authenticate
1293-
image: robertstettner/drone-npm-auth
1294-
settings:
1295-
username:
1296-
from_secret: npm_username
1297-
token:
1298-
from_secret: npm_token
1299-
when:
1300-
branch:
1301-
- main
1302-
target:
1303-
- sdk-publish-beta
1304-
depends_on:
1305-
- npm-publish-beta
1306-
1307-
- name: npm-retag-latest
1308-
image: node:18.19
1309-
commands:
1310-
- npm dist-tag add @iexec/dataprotector@$(cd packages/sdk/ && npm pkg get version | sed 's/"//g') latest
1311-
when:
1312-
branch:
1313-
- main
1314-
target:
1315-
- sdk-publish-beta
1316-
depends_on:
1317-
- npm-authenticate
1318-
1319-
---
1320-
kind: pipeline
1321-
type: docker
1322-
name: sdk deprecate npm version
1323-
1324-
trigger:
1325-
event:
1326-
- promote
1327-
target:
1328-
# deprecates a version of @iexec/dataprotector
1329-
- sdk-deprecate-package
1330-
1331-
steps:
1332-
- name: authenticate
1333-
image: robertstettner/drone-npm-auth
1334-
settings:
1335-
username:
1336-
from_secret: npm_username
1337-
token:
1338-
from_secret: npm_token
1339-
1340-
- name: deprecate package
1341-
image: node:18.19
1342-
params:
1343-
- PACKAGE_VERSION
1344-
commands:
1345-
- if [ -n "$PACKAGE_VERSION" ]; then npm deprecate @iexec/dataprotector@$PACKAGE_VERSION "deprecate $PACKAGE_VERSION"; else echo "PACKAGE_VERSION is not set"; fi
1346-
1347-
---
1348-
kind: pipeline
1349-
type: docker
1350-
name: sdk undeprecate npm version
1351-
1352-
trigger:
1353-
event:
1354-
- promote
1355-
target:
1356-
# remove the deprecation of a version of @iexec/dataprotector
1357-
- sdk-undeprecate-package
1358-
1359-
steps:
1360-
- name: authenticate
1361-
image: robertstettner/drone-npm-auth
1362-
settings:
1363-
username:
1364-
from_secret: npm_username
1365-
token:
1366-
from_secret: npm_token
1367-
1368-
- name: undeprecate package
1369-
image: node:18.19
1370-
params:
1371-
- PACKAGE_VERSION
1372-
commands:
1373-
- if [ -n "$PACKAGE_VERSION" ]; then npm deprecate @iexec/dataprotector@$PACKAGE_VERSION ""; else echo "PACKAGE_VERSION is not set"; fi
1374-
13751209
---
13761210
kind: pipeline
13771211
type: docker
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish Package NPM
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
target:
7+
description: 'Select deployment target'
8+
required: true
9+
default: staging
10+
type: choice
11+
options:
12+
- staging
13+
- prod
14+
15+
jobs:
16+
publish-npm:
17+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
18+
with:
19+
scope: '@iexec/dataprotector-sdk'
20+
registry: 'https://registry.npmjs.org'
21+
node-version: '18'
22+
environment: ${{ github.event.inputs.target }}
23+
secrets:
24+
npm-token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)