From 86b7d7c3a04f9f37e2ed2734682591e5b9e3a897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristina=20Isabel=20Ca=C3=B1izales?= Date: Wed, 28 Aug 2024 17:41:54 -0300 Subject: [PATCH] chore: modify workflows to skip publish upon a prerelease --- .github/workflows/esbuild-publish.yml | 23 +++++++++++++++-------- .github/workflows/onRelease.yml | 9 +++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/esbuild-publish.yml b/.github/workflows/esbuild-publish.yml index eaa7e65436..fbe3d402f3 100644 --- a/.github/workflows/esbuild-publish.yml +++ b/.github/workflows/esbuild-publish.yml @@ -1,11 +1,18 @@ name: esbuild Compilation & npm Publish Workflow on: - workflow_run: - workflows: - - create-github-release - types: - - completed + workflow_call: + inputs: + branch: + description: 'Set the branch to use for automation tests' + type: string + required: false + default: 'main' + nodeVersion: + description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers + type: string + default: lts/* + required: false workflow_dispatch: inputs: branch: @@ -14,7 +21,7 @@ on: required: false default: 'main' nodeVersion: - description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers + description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers type: string default: lts/* required: false @@ -22,14 +29,14 @@ on: jobs: build: runs-on: ubuntu-latest - if: ${{ inputs.branch || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')}} + if: ${{ inputs.branch }} steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} - uses: actions/setup-node@v4 with: - node-version: ${{ inputs.nodeVersion || 'lts/*' }} + node-version: ${{ inputs.nodeVersion }} registry-url: 'https://registry.npmjs.org' cache: yarn - uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main diff --git a/.github/workflows/onRelease.yml b/.github/workflows/onRelease.yml index db03117ac4..75f48f75d3 100644 --- a/.github/workflows/onRelease.yml +++ b/.github/workflows/onRelease.yml @@ -30,3 +30,12 @@ jobs: tag: ${{ needs.getDistTag.outputs.tag || 'latest' }} githubTag: ${{ github.event.release.tag_name || inputs.tag }} secrets: inherit + + publish-bundle: + if: ${{ success() && needs.getDistTag.outputs.tag == '' }} + uses: ./.github/workflows/esbuild-publish.yml + needs: [getDistTag, npm] + with: + branch: 'main' + nodeVersion: 'lts/*' + secrets: inherit