bump_patch_version.yml

 1name: bump_patch_version
 2
 3on:
 4  workflow_dispatch:
 5    inputs:
 6      branch:
 7        description: "Branch name to run on"
 8        required: true
 9
10concurrency:
11  # Allow only one workflow per any non-`main` branch.
12  group: ${{ github.workflow }}-${{ inputs.branch }}
13  cancel-in-progress: true
14
15jobs:
16  bump_patch_version:
17    runs-on:
18      - buildjet-16vcpu-ubuntu-2204
19    steps:
20      - name: Checkout code
21        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
22        with:
23          ref: ${{ github.event.inputs.branch }}
24          ssh-key: ${{ secrets.ZED_BOT_DEPLOY_KEY }}
25
26      - name: Bump Patch Version
27        run: |
28          set -eux
29
30          channel=$(cat crates/zed/RELEASE_CHANNEL)
31
32          tag_suffix=""
33          case $channel in
34            stable)
35              ;;
36            preview)
37              tag_suffix="-pre"
38              ;;
39            *)
40              echo "this must be run on either of stable|preview release branches" >&2
41              exit 1
42              ;;
43          esac
44          which cargo-set-version > /dev/null || cargo install cargo-edit
45          output=$(cargo set-version -p zed --bump patch 2>&1 | sed 's/.* //')
46          export GIT_COMMITTER_NAME="Zed Bot"
47          export GIT_COMMITTER_EMAIL="hi@zed.dev"
48          git commit -am "Bump to $output for @$GITHUB_ACTOR" --author "Zed Bot <hi@zed.dev>"
49          git tag v${output}${tag_suffix}
50          git push origin HEAD v${output}${tag_suffix}