From b5109e1e3dd0588bf42b88087696f55115870e10 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Mon, 6 May 2024 17:02:13 -0500 Subject: [PATCH] ci: sync CI with current for prerel capability --- .github/workflows/create-github-release.yml | 33 +++++++++++++++++++ .github/workflows/manualRelease.yml | 36 --------------------- .github/workflows/onPushToMain.yml | 11 ------- .github/workflows/onRelease.yml | 27 ++++++++++++---- 4 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/create-github-release.yml delete mode 100644 .github/workflows/manualRelease.yml delete mode 100644 .github/workflows/onPushToMain.yml diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml new file mode 100644 index 0000000..562dc75 --- /dev/null +++ b/.github/workflows/create-github-release.yml @@ -0,0 +1,33 @@ +name: create-github-release + +on: + push: + branches: + - main + - prerelease/** + tags-ignore: + - "*" + workflow_dispatch: + inputs: + prerelease: + type: string + description: "Name to use for the prerelease: beta, dev, etc. NOTE: If this is already set in the package.json, it does not need to be passed in here." + +jobs: + release: + uses: salesforcecli/github-workflows/.github/workflows/create-github-release.yml@main + with: + prerelease: ${{ inputs.prerelease }} + # If this is a push event, we want to skip the release if there are no semantic commits + # However, if this is a manual release (workflow_dispatch), then we want to disable skip-on-empty + # This helps recover from forgetting to add semantic commits ('fix:', 'feat:', etc.) + skip-on-empty: ${{ github.event_name == 'push' }} + secrets: + SVC_CLI_BOT_GITHUB_TOKEN: ${{ secrets.IDEE_GH_TOKEN }} + # docs: + # # Most repos won't use this + # # Depends on the 'release' job to avoid git collisions, not for any functionality reason + # needs: release + # secrets: inherit + # if: ${{ github.ref_name == 'main' }} + # uses: salesforcecli/github-workflows/.github/workflows/publishTypedoc.yml@main diff --git a/.github/workflows/manualRelease.yml b/.github/workflows/manualRelease.yml deleted file mode 100644 index 9932797..0000000 --- a/.github/workflows/manualRelease.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: manual release - -on: - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.IDEE_GH_TOKEN }} - - name: Conventional Changelog Action - id: changelog - uses: TriPSs/conventional-changelog-action@d360fad3a42feca6462f72c97c165d60a02d4bf2 - # overriding some of the basic behaviors to just get the changelog - with: - git-user-name: Release Bot - git-user-email: ${{ secrets.IDEE_GH_EMAIL }} - github-token: ${{ secrets.IDEE_GH_TOKEN }} - output-file: false - # always do the release, even if there are no semantic commits - skip-on-empty: false - tag-prefix: '' - - uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216 - id: packageVersion - with: - path: 'package.json' - prop_path: 'version' - - name: Create Github Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.IDEE_GH_TOKEN }} - with: - tag_name: ${{ steps.packageVersion.outputs.prop }} - release_name: ${{ steps.packageVersion.outputs.prop }} diff --git a/.github/workflows/onPushToMain.yml b/.github/workflows/onPushToMain.yml deleted file mode 100644 index 5530bd2..0000000 --- a/.github/workflows/onPushToMain.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: version, tag and github release - -on: - push: - branches: [main] - -jobs: - release: - uses: salesforcecli/github-workflows/.github/workflows/githubRelease.yml@gbockus/updateReleaseToIncludeTokenInput - secrets: - ALT_GITHUB_TOKEN: ${{ secrets.IDEE_GH_TOKEN }} diff --git a/.github/workflows/onRelease.yml b/.github/workflows/onRelease.yml index 41d2533..d9102e0 100644 --- a/.github/workflows/onRelease.yml +++ b/.github/workflows/onRelease.yml @@ -1,18 +1,33 @@ -# when a github release happens, publish an npm package, +name: publish on: release: - types: [released] - # support manual release + # both release and prereleases + types: [published] + # support manual release in case something goes wrong and needs to be repeated or tested workflow_dispatch: inputs: tag: - description: tag that needs to publish + description: github tag that needs to publish type: string required: true jobs: + getDistTag: + outputs: + tag: ${{ steps.distTag.outputs.tag }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + 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: false + ctc: true + sign: true + tag: ${{ needs.getDistTag.outputs.tag || 'latest' }} githubTag: ${{ github.event.release.tag_name || inputs.tag }} - secrets: inherit \ No newline at end of file + + secrets: inherit