Skip to content

Commit

Permalink
chore(ci): modify workflows to skip publish upon a prerelease (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
CristiCanizales authored Aug 29, 2024
1 parent 56e39c6 commit 3409db2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/esbuild-publish.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -14,22 +21,22 @@ 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

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
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3409db2

Please sign in to comment.