|
1 | | -name: Publish Package NPM |
| 1 | +name: Publish Package NPM - Deserializer |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
|
10 | 10 | options: |
11 | 11 | - latest |
12 | 12 | - nightly |
| 13 | + - beta |
13 | 14 | default: nightly |
14 | 15 |
|
15 | 16 | jobs: |
16 | | - set-env: |
| 17 | + set-publish-version: |
17 | 18 | runs-on: ubuntu-latest |
18 | | - outputs: |
19 | | - resolved-environment: ${{ steps.setenv.outputs.env }} |
20 | 19 | steps: |
21 | | - - id: setenv |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + - name: Set up Node.js |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + - name: Set publish version |
| 25 | + id: set-publish-version |
| 26 | + if: github.event.inputs.tag == 'nightly' |
| 27 | + working-directory: packages/sdk |
22 | 28 | run: | |
23 | | - if [ "${{ github.event.inputs.tag }}" = "latest" ]; then |
24 | | - echo "env=production" >> $GITHUB_OUTPUT |
| 29 | + if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then |
| 30 | + CURRENT_VERSION=$(npm pkg get version | tr -d '"') |
| 31 | + NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}" |
| 32 | + echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT |
25 | 33 | else |
26 | | - echo "env=staging" >> $GITHUB_OUTPUT |
| 34 | + echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT |
27 | 35 | fi |
| 36 | + outputs: |
| 37 | + VERSION: ${{ steps.set-publish-version.outputs.VERSION }} |
28 | 38 |
|
29 | 39 | publish-npm: |
30 | | - needs: set-env |
31 | | - uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-[email protected] |
| 40 | + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] |
| 41 | + needs: set-publish-version |
32 | 42 | with: |
33 | 43 | scope: '@iexec/deserializer' |
34 | 44 | registry: 'https://registry.npmjs.org' |
35 | 45 | node-version: '18' |
36 | | - environment: ${{ needs.set-env.outputs.resolved-environment }} |
| 46 | + tag: ${{ github.event.inputs.tag }} |
| 47 | + environment: production |
37 | 48 | working-directory: "packages/dataprotector-deserializer" |
| 49 | + version: ${{ needs.set-publish-version.outputs.VERSION }} |
| 50 | + install-command: | |
| 51 | + npm ci |
| 52 | + cd ../sdk |
| 53 | + npm ci |
| 54 | + npm run codegen |
| 55 | + npm run build |
| 56 | + cd ../dataprotector-deserializer |
| 57 | + npm run test:prepare |
38 | 58 | secrets: |
39 | 59 | npm-token: ${{ secrets.NPM_TOKEN }} |
0 commit comments