From 5cf2f571a5a9d8822e2a3a0270318aceeb2d4c19 Mon Sep 17 00:00:00 2001 From: Ugo Mignon Date: Mon, 17 Mar 2025 10:42:14 +0100 Subject: [PATCH 1/5] ci(deserializer): add GHA for NPM publishing --- .drone.yml | 110 ------------------ github/workflows/publish-npm-deserializer.yml | 24 ++++ 2 files changed, 24 insertions(+), 110 deletions(-) create mode 100644 github/workflows/publish-npm-deserializer.yml diff --git a/.drone.yml b/.drone.yml index e423b0484..7fe1fde75 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1371,113 +1371,3 @@ steps: - PACKAGE_VERSION commands: - if [ -n "$PACKAGE_VERSION" ]; then npm deprecate @iexec/dataprotector@$PACKAGE_VERSION ""; else echo "PACKAGE_VERSION is not set"; fi - ---- -kind: pipeline -type: docker -name: dataprotector-deserializer publish npm - -trigger: - event: - - promote - target: - # publish the package @iexec/dataprotector-deserializer on npm with the tag nightly - - dataprotector-deserializer-publish-nightly - # publish the package @iexec/dataprotector-deserializer on npm with the tag latest - - dataprotector-deserializer-publish-latest - branch: - - develop - - main - -steps: - - name: build test dependency dataprotector-sdk - image: node:18 - pull: always - commands: - - cd packages/sdk - - npm ci - - npm run codegen - - npm run build - - - name: install - image: node:18 - pull: always - commands: - - cd packages/dataprotector-deserializer - - node -v - - npm -v - - npm ci - - npm run test:prepare - - - name: format - image: node:18 - commands: - - cd packages/dataprotector-deserializer - - npm run check-format - - - name: lint - image: node:18 - commands: - - cd packages/dataprotector-deserializer - - npm run lint - - - name: check-types - image: node:18 - commands: - - cd packages/dataprotector-deserializer - - npm run check-types - - - name: test - image: node:18 - commands: - - cd packages/dataprotector-deserializer - - npm run test - - - name: build - image: node:18 - commands: - - cd packages/dataprotector-deserializer - - npm run build - - - name: set nightly version - image: node:18.19 - commands: - - cd packages/dataprotector-deserializer - - eval npm pkg set version="$(npm pkg get version)-nightly-$DRONE_COMMIT" - when: - branch: - - develop - target: - - dataprotector-deserializer-publish-nightly - - - name: npm publish nightly - image: plugins/npm - settings: - username: - from_secret: npm_username - token: - from_secret: npm_token_dataprotector_deserializer - tag: nightly - access: public - folder: packages/dataprotector-deserializer - when: - branch: - - develop - target: - - dataprotector-deserializer-publish-nightly - - - name: npm publish latest - image: plugins/npm - settings: - username: - from_secret: npm_username - token: - from_secret: npm_token_dataprotector_deserializer - tag: latest - access: public - folder: packages/dataprotector-deserializer - when: - branch: - - main - target: - - dataprotector-deserializer-publish-latest diff --git a/github/workflows/publish-npm-deserializer.yml b/github/workflows/publish-npm-deserializer.yml new file mode 100644 index 000000000..bc04a2178 --- /dev/null +++ b/github/workflows/publish-npm-deserializer.yml @@ -0,0 +1,24 @@ +name: Publish Package NPM + +on: + workflow_dispatch: + inputs: + tag: + description: 'NPM tag to publish (latest or nightly)' + required: true + type: choice + options: + - latest + - nightly + default: nightly # Check this with the team + +jobs: + publish-npm: + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.0.0 + with: + scope: '@iexec/deserializer' + registry: 'https://registry.npmjs.org' + node-version: '18' + environment: ${{ inputs.tag == 'latest' ? 'production' : 'staging' }} + secrets: + npm-token: ${{ secrets.NPM_TOKEN }} From 710c14dd42ca58a0c67ddf9647ce8ebfe25836e5 Mon Sep 17 00:00:00 2001 From: Ugo Mignon <56931733+TartanLeGrand@users.noreply.github.com> Date: Wed, 11 Jun 2025 08:28:47 +0200 Subject: [PATCH 2/5] fix: working dir --- github/workflows/publish-npm-deserializer.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/github/workflows/publish-npm-deserializer.yml b/github/workflows/publish-npm-deserializer.yml index bc04a2178..6dbfe1a63 100644 --- a/github/workflows/publish-npm-deserializer.yml +++ b/github/workflows/publish-npm-deserializer.yml @@ -20,5 +20,6 @@ jobs: registry: 'https://registry.npmjs.org' node-version: '18' environment: ${{ inputs.tag == 'latest' ? 'production' : 'staging' }} + working-directory: "packages/dataprotector-deserializer" secrets: npm-token: ${{ secrets.NPM_TOKEN }} From de39b906c6a3acb1a138016a80f755c42a071713 Mon Sep 17 00:00:00 2001 From: SeddikBellamine Date: Wed, 11 Jun 2025 14:52:19 +0200 Subject: [PATCH 3/5] ci (dataprotectord-deserializer) : fix workflow --- .../workflows/publish-npm-deserializer.yml | 39 +++++++++++++++++++ github/workflows/publish-npm-deserializer.yml | 25 ------------ 2 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/publish-npm-deserializer.yml delete mode 100644 github/workflows/publish-npm-deserializer.yml diff --git a/.github/workflows/publish-npm-deserializer.yml b/.github/workflows/publish-npm-deserializer.yml new file mode 100644 index 000000000..beb547786 --- /dev/null +++ b/.github/workflows/publish-npm-deserializer.yml @@ -0,0 +1,39 @@ +name: Publish Package NPM + +on: + workflow_dispatch: + inputs: + tag: + description: 'NPM tag to publish (latest or nightly)' + required: true + type: choice + options: + - latest + - nightly + default: nightly + +jobs: + set-env: + runs-on: ubuntu-latest + outputs: + resolved-environment: ${{ steps.setenv.outputs.env }} + steps: + - id: setenv + run: | + if [ "${{ github.event.inputs.tag }}" = "latest" ]; then + echo "env=production" >> $GITHUB_OUTPUT + else + echo "env=staging" >> $GITHUB_OUTPUT + fi + + publish-npm: + needs: set-env + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.3.0 + with: + scope: '@iexec/deserializer' + registry: 'https://registry.npmjs.org' + node-version: '18' + environment: ${{ needs.set-env.outputs.resolved-environment }} + working-directory: "packages/dataprotector-deserializer" + secrets: + npm-token: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/github/workflows/publish-npm-deserializer.yml b/github/workflows/publish-npm-deserializer.yml deleted file mode 100644 index 6dbfe1a63..000000000 --- a/github/workflows/publish-npm-deserializer.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Publish Package NPM - -on: - workflow_dispatch: - inputs: - tag: - description: 'NPM tag to publish (latest or nightly)' - required: true - type: choice - options: - - latest - - nightly - default: nightly # Check this with the team - -jobs: - publish-npm: - uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.0.0 - with: - scope: '@iexec/deserializer' - registry: 'https://registry.npmjs.org' - node-version: '18' - environment: ${{ inputs.tag == 'latest' ? 'production' : 'staging' }} - working-directory: "packages/dataprotector-deserializer" - secrets: - npm-token: ${{ secrets.NPM_TOKEN }} From 0f13d3a8e443f4327cf6527377b04d339eda9dce Mon Sep 17 00:00:00 2001 From: Ugo Mignon <56931733+TartanLeGrand@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:18:39 +0200 Subject: [PATCH 4/5] fix: indent --- .github/workflows/publish-npm-deserializer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-npm-deserializer.yml b/.github/workflows/publish-npm-deserializer.yml index beb547786..b63d67153 100644 --- a/.github/workflows/publish-npm-deserializer.yml +++ b/.github/workflows/publish-npm-deserializer.yml @@ -36,4 +36,4 @@ jobs: environment: ${{ needs.set-env.outputs.resolved-environment }} working-directory: "packages/dataprotector-deserializer" secrets: - npm-token: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + npm-token: ${{ secrets.NPM_TOKEN }} From 8a40a38ab3d89aaef771a18a2171e527e45cdad9 Mon Sep 17 00:00:00 2001 From: SeddikBellamine Date: Wed, 11 Jun 2025 15:24:35 +0200 Subject: [PATCH 5/5] keep drone --- .drone.yml | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/.drone.yml b/.drone.yml index 59affb28a..20b7f231f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1174,3 +1174,113 @@ steps: - PACKAGE_VERSION commands: - if [ -n "$PACKAGE_VERSION" ]; then npm deprecate @iexec/dataprotector@$PACKAGE_VERSION ""; else echo "PACKAGE_VERSION is not set"; fi + +--- +kind: pipeline +type: docker +name: dataprotector-deserializer publish npm + +trigger: + event: + - promote + target: + # publish the package @iexec/dataprotector-deserializer on npm with the tag nightly + - dataprotector-deserializer-publish-nightly + # publish the package @iexec/dataprotector-deserializer on npm with the tag latest + - dataprotector-deserializer-publish-latest + branch: + - develop + - main + +steps: + - name: build test dependency dataprotector-sdk + image: node:18 + pull: always + commands: + - cd packages/sdk + - npm ci + - npm run codegen + - npm run build + + - name: install + image: node:18 + pull: always + commands: + - cd packages/dataprotector-deserializer + - node -v + - npm -v + - npm ci + - npm run test:prepare + + - name: format + image: node:18 + commands: + - cd packages/dataprotector-deserializer + - npm run check-format + + - name: lint + image: node:18 + commands: + - cd packages/dataprotector-deserializer + - npm run lint + + - name: check-types + image: node:18 + commands: + - cd packages/dataprotector-deserializer + - npm run check-types + + - name: test + image: node:18 + commands: + - cd packages/dataprotector-deserializer + - npm run test + + - name: build + image: node:18 + commands: + - cd packages/dataprotector-deserializer + - npm run build + + - name: set nightly version + image: node:18.19 + commands: + - cd packages/dataprotector-deserializer + - eval npm pkg set version="$(npm pkg get version)-nightly-$DRONE_COMMIT" + when: + branch: + - develop + target: + - dataprotector-deserializer-publish-nightly + + - name: npm publish nightly + image: plugins/npm + settings: + username: + from_secret: npm_username + token: + from_secret: npm_token_dataprotector_deserializer + tag: nightly + access: public + folder: packages/dataprotector-deserializer + when: + branch: + - develop + target: + - dataprotector-deserializer-publish-nightly + + - name: npm publish latest + image: plugins/npm + settings: + username: + from_secret: npm_username + token: + from_secret: npm_token_dataprotector_deserializer + tag: latest + access: public + folder: packages/dataprotector-deserializer + when: + branch: + - main + target: + - dataprotector-deserializer-publish-latest \ No newline at end of file