From f87e02ab56d732b1796dff7f7515292ad0450976 Mon Sep 17 00:00:00 2001 From: Eric Willhoit Date: Mon, 17 Apr 2023 14:57:25 -0500 Subject: [PATCH] chore: prerelease actions --- .github/workflows/onPushToMain.yml | 17 ++++++++--------- .github/workflows/onRelease.yml | 19 ++++++++++++++++--- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/onPushToMain.yml b/.github/workflows/onPushToMain.yml index b00f1cb..6cf17c5 100644 --- a/.github/workflows/onPushToMain.yml +++ b/.github/workflows/onPushToMain.yml @@ -1,18 +1,17 @@ -# test name: version, tag and github release on: push: - branches: [main] + branches: + - main + - prerelease/* + tags-ignore: + - "*" jobs: release: + # this job will throw if prerelease is true but it doesn't have a prerelease-looking package.json version uses: salesforcecli/github-workflows/.github/workflows/githubRelease.yml@main secrets: inherit - - # most repos won't use this - # depends on previous job to avoid git collisions, not for any functionality reason - # docs: - # uses: salesforcecli/github-workflows/.github/workflows/publishTypedoc.yml@main - # secrets: inherit - # needs: release + with: + prerelease: ${{ github.ref_name != 'main' }} \ No newline at end of file diff --git a/.github/workflows/onRelease.yml b/.github/workflows/onRelease.yml index 93e3878..2cbf534 100644 --- a/.github/workflows/onRelease.yml +++ b/.github/workflows/onRelease.yml @@ -2,20 +2,33 @@ name: publish on: release: - types: [released] - # support manual release in case something goes wrong and needs to be repeated or tested + types: [published] workflow_dispatch: inputs: tag: description: tag that needs to publish type: string required: true + jobs: + # parses the package.json version and detects prerelease tag (ex: beta from 4.4.4-beta.0) + getDistTag: + outputs: + tag: ${{ steps.distTag.outputs.tag }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.release.tag_name || inputs.tag }} + - uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main + id: distTag + npm: uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main + needs: [getDistTag] with: ctc: true sign: true - tag: latest + tag: ${{ needs.getDistTag.outputs.tag || 'latest' }} githubTag: ${{ github.event.release.tag_name || inputs.tag }} secrets: inherit