From 03d871eca84b8a996c263cd322fee498eeadc877 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Tue, 7 Oct 2025 10:06:51 +0200 Subject: [PATCH] Add GitHub Actions workflow for publishing draft releases --- .github/workflows/publish_release.yml | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/publish_release.yml diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml new file mode 100644 index 0000000..0b4f538 --- /dev/null +++ b/.github/workflows/publish_release.yml @@ -0,0 +1,53 @@ +name: Publish draft release + +on: + workflow_dispatch: + +permissions: + contents: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Get latest draft release + id: draft + run: | + draft_info=$(gh release list --limit 5 --json tagName,isDraft,publishedAt --jq '.[] | select(.isDraft==true) | .tagName' | head -n1) + echo "tag_name=${draft_info}" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate draft version + run: | + if [ -z "${{ steps.draft.outputs.tag_name }}" ]; then + echo "No draft release found!" >&2 + exit 1 + fi + echo "Found draft version: ${{ steps.draft.outputs.tag_name }}" + + - name: Write VERSION file + run: | + echo "${{ steps.draft.outputs.tag_name }}" | sed 's/^v//' > VERSION + cat VERSION + + - name: Commit VERSION file + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add VERSION + git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes to commit" + git push + +# - name: Create tag +# run: | +# git tag "${{ steps.draft.outputs.tag_name }}" +# git push origin "${{ steps.draft.outputs.tag_name }}" +# +# - name: Publish draft release +# run: gh release edit "${{ steps.draft.outputs.tag_name }}" --draft=false +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}