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    if: github.repository_owner == 'zed-industries'
18    runs-on:
19      - namespace-profile-16x32-ubuntu-2204
20    steps:
21      - name: Checkout code
22        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
23        with:
24          ref: ${{ github.event.inputs.branch }}
25          ssh-key: ${{ secrets.ZED_BOT_DEPLOY_KEY }}
26
27      - name: Bump Patch Version
28        run: |
29          set -eux
30
31          channel="$(cat crates/zed/RELEASE_CHANNEL)"
32
33          tag_suffix=""
34          case $channel in
35            stable)
36              ;;
37            preview)
38              tag_suffix="-pre"
39              ;;
40            *)
41              echo "this must be run on either of stable|preview release branches" >&2
42              exit 1
43              ;;
44          esac
45          which cargo-set-version > /dev/null || cargo install cargo-edit
46          output="$(cargo set-version -p zed --bump patch 2>&1 | sed 's/.* //')"
47          export GIT_COMMITTER_NAME="Zed Bot"
48          export GIT_COMMITTER_EMAIL="hi@zed.dev"
49          git commit -am "Bump to $output for @$GITHUB_ACTOR" --author "Zed Bot <hi@zed.dev>"
50          git tag "v${output}${tag_suffix}"
51          git push origin HEAD "v${output}${tag_suffix}"