From fea5b4d0dcdaf8a9c8129b5ab751d315c4b7a345 Mon Sep 17 00:00:00 2001 From: Timo Reichl Date: Wed, 4 Oct 2023 20:43:24 +0200 Subject: [PATCH] CI: Draft a release on tag pushes Signed-off-by: Timo Reichl --- .github/workflows/build-push-tag.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/build-push-tag.yml b/.github/workflows/build-push-tag.yml index 6019891..04b76fe 100644 --- a/.github/workflows/build-push-tag.yml +++ b/.github/workflows/build-push-tag.yml @@ -80,3 +80,23 @@ jobs: docker push ${GHCR_PREFIX}/${REGISTRY_IMAGE}:${docker_image}-${{ github.ref_name }} docker push ${DOCKER_HUB_PREFIX}/${REGISTRY_IMAGE}:${docker_image}-${{ github.ref_name }} done + + # Copied and modified from k0sctl: https://github.com/k0sproject/k0sctl/blob/main/.github/workflows/release.yaml + ## Ugly hack to get the tag name + ## github.ref gives the full reference like refs.tags.v0.0.1-beta1 + - name: Get branch name to draft release + if: ${{ inputs.tag }} + id: branch_name + run: | + echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT} + + - name: Draft release + if: ${{ inputs.tag }} + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + body: "${{ steps.branch_name.outputs.TAG_NAME }}" + tag_name: ${{ steps.branch_name.outputs.TAG_NAME }} + name: ${{ steps.branch_name.outputs.TAG_NAME }} + draft: true # So we can manually edit before publishing + prerelease: false