From e3cd80d679a505ab09b4425931ed81160e978196 Mon Sep 17 00:00:00 2001 From: schmidtw Date: Thu, 20 Jun 2024 21:49:55 -0700 Subject: [PATCH] fix:Make the auto releaser tag by default instead of release directly. --- .github/workflows/auto-releaser.yml | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-releaser.yml b/.github/workflows/auto-releaser.yml index ffec82b..5b9d829 100644 --- a/.github/workflows/auto-releaser.yml +++ b/.github/workflows/auto-releaser.yml @@ -20,17 +20,25 @@ name: 'Auto Releaser' on: workflow_call: inputs: + branch: description: 'Branch to release from.' type: string required: false default: 'main' + patch-list: description: 'Comma separated list of commit types that should trigger a patch release.' type: string required: false default: 'fix, bugfix, perf, refactor, test, tests, chore' + which: + description: Create a 'release' or 'tag'. + type: string + required: false + default: tag + jobs: release: permissions: write-all @@ -57,10 +65,34 @@ jobs: - name: Create Release if: | - steps.semver.outputs.next != '' + steps.semver.outputs.next != '' && + inputs.which == 'tag' uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 with: name: ${{ steps.semver.outputs.next }} tag: ${{ steps.semver.outputs.next }} commit: ${{ github.sha }} token: ${{ github.token }} + + - name: Create Tag + if: | + steps.semver.outputs.next != '' && + inputs.which == 'tag' + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{ steps.semver.outputs.next }}', + sha: context.sha + } + + - name: Failure + if: | + steps.semver.outputs.next != '' && + inputs.which != 'release' && + inputs.which != 'tag' + run: | + echo "No new version found." + exit