Update GitHub Actions workflow for draft release

This commit is contained in:
Michel Roegl-Brunner
2025-10-07 10:45:31 +02:00
committed by GitHub
parent 6baef6bb84
commit b96b5493f3

View File

@@ -2,6 +2,7 @@ name: Publish draft release
on: on:
workflow_dispatch: workflow_dispatch:
permissions: permissions:
contents: write contents: write
pull-requests: write pull-requests: write
@@ -13,6 +14,7 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Get latest draft release - name: Get latest draft release
id: draft id: draft
run: | run: |
@@ -29,6 +31,7 @@ jobs:
fi fi
echo "Found draft version: ${{ steps.draft.outputs.tag_name }}" echo "Found draft version: ${{ steps.draft.outputs.tag_name }}"
- name: Create branch and commit VERSION - name: Create branch and commit VERSION
run: | run: |
branch="update-version-${{ steps.draft.outputs.tag_name }}" branch="update-version-${{ steps.draft.outputs.tag_name }}"
@@ -37,12 +40,13 @@ jobs:
git add VERSION git add VERSION
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes" git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes to commit"
git push origin "$branch" git push --set-upstream origin "$branch" --force
- name: Create PR
uses: peter-evans/create-pull-request@v6 - name: Create pull request
id: pr id: pr
uses: peter-evans/create-pull-request@v6
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
branch: "update-version-${{ steps.draft.outputs.tag_name }}" branch: "update-version-${{ steps.draft.outputs.tag_name }}"
@@ -51,6 +55,7 @@ jobs:
body: "This PR adds or updates the VERSION file for ${{ steps.draft.outputs.tag_name }}" body: "This PR adds or updates the VERSION file for ${{ steps.draft.outputs.tag_name }}"
labels: automated labels: automated
- name: Auto-merge PR - name: Auto-merge PR
uses: peter-evans/enable-pull-request-automerge@v2 uses: peter-evans/enable-pull-request-automerge@v2
with: with:
@@ -58,7 +63,7 @@ jobs:
pull-request-number: ${{ steps.pr.outputs.pull-request-number }} pull-request-number: ${{ steps.pr.outputs.pull-request-number }}
merge-method: squash merge-method: squash
- name: Wait for merge - name: Wait for PR merge
uses: actions/github-script@v7 uses: actions/github-script@v7
with: with:
script: | script: |