From 53fc25ac17b775228aa7eabacb214dcafa67e312 Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Mon, 12 Aug 2024 16:51:43 +0800 Subject: [PATCH] refactor: add tag control to publish pipeline --- .github/workflows/publish-template.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/publish-template.yml b/.github/workflows/publish-template.yml index 706825a..0475330 100644 --- a/.github/workflows/publish-template.yml +++ b/.github/workflows/publish-template.yml @@ -13,6 +13,10 @@ on: description: "release type(alpha, rc, stable)" required: true default: "alpha" + add-tag: + description: "add tag to the release" + required: true + default: "false" permissions: contents: read @@ -27,6 +31,12 @@ jobs: echo "Invalid release type '${{ github.event.inputs.release-type }}' provided. Valid values are 'alpha', 'rc', 'stable'." exit 1 + - name: Validate add tag + if: ${{ github.event.inputs.add-tag != 'false' && github.event.inputs.add-tag != 'true' }} + run: | + echo "Invalid add tag '${{ github.event.inputs.add-tag }}' provided. Valid values are 'true', 'false'." + exit 1 + - name: Checkout branch uses: actions/checkout@v4 with: @@ -54,3 +64,10 @@ jobs: with: name: ${{ env.TEMPLATE_NAME }} path: template.zip + + - name: Release template ZIP file To GitHub Release + uses: softprops/action-gh-release@v2 + if: ${{ github.event.inputs.add-tag == 'true' }} + with: + tag_name: ${{ env.TIMESTAMP }}-${{ inputs.publish-branch }}-${{ inputs.release-type }} + files: template.zip