From 686d5496a4644b6b0bf986c0ed1c4b10002c05d0 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Thu, 22 Oct 2026 17:31:12 +0200 Subject: [PATCH] Add workflow that automatically open version bump PR --- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ffbdf73 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: "Release: Prepare" + +on: + workflow_dispatch: + inputs: + version: + description: "Version to release, e.g. 1.2.3" + required: true + type: string + +permissions: + contents: read + +jobs: + bump: + runs-on: ubuntu-latest + permissions: {} + steps: + - name: Check version + env: + VERSION: ${{ inputs.version }} + run: | + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Version must look like 1.2.3, got: $VERSION" + exit 1 + fi + + - name: Checkout repo + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: main + token: ${{ secrets.RELEASE_PR_TOKEN }} + + - name: Install uv + uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 + + - name: Bump version + env: + VERSION: ${{ inputs.version }} + run: | + old=$(uv version --short) + uv version "$VERSION" --no-sync + sed -i "s/\"version\": \"$old\"/\"version\": \"$VERSION\"/" manifest.json server.json + + - name: Open pull request + env: + GH_TOKEN: ${{ secrets.RELEASE_PR_TOKEN }} + VERSION: ${{ inputs.version }} + run: | + git switch -c "release/v$VERSION" + git -c user.name="github-actions[bot]" \ + -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \ + commit -am "Bump version to $VERSION" + git push origin "release/v$VERSION" + gh pr create --base main --title "Bump version to $VERSION" \ + --body "After merging, push the \`v$VERSION\` tag to publish the release."