Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions .github/workflows/publish-npm-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,52 @@ name: Publish Package NPM
on:
workflow_dispatch:
inputs:
target:
description: 'Select deployment target'
tag:
description: 'NPM tag to publish (latest or nightly)'
required: true
default: staging
type: choice
options:
- staging
- prod
- latest
- nightly
- beta
default: nightly

jobs:
set-publish-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
- name: Set publish version
id: set-publish-version
if: github.event.inputs.tag == 'nightly'
working-directory: packages/sdk
run: |
if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
else
echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
fi
outputs:
VERSION: ${{ steps.set-publish-version.outputs.VERSION }}

publish-npm:
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
needs: set-publish-version
with:
scope: '@iexec/dataprotector-sdk'
registry: 'https://registry.npmjs.org'
node-version: '18'
environment: ${{ github.event.inputs.target }}
working-directory: packages/sdk
working-directory: packages/sdk
tag: ${{ github.event.inputs.tag }}
version: ${{ needs.set-publish-version.outputs.VERSION }}
install-command: |
npm ci
npm run codegen
secrets:
npm-token: ${{ secrets.NPM_TOKEN }}
Loading