1# Generated from xtask::workflows::bump_patch_version
2# Rebuild with `cargo xtask workflows`.
3name: bump_patch_version
4on:
5 workflow_dispatch:
6 inputs:
7 branch:
8 description: Branch name to run on
9 required: true
10 type: string
11jobs:
12 run_bump_patch_version:
13 if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
14 runs-on: namespace-profile-16x32-ubuntu-2204
15 steps:
16 - id: generate-token
17 name: steps::authenticate_as_zippy
18 uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
19 with:
20 app-id: ${{ secrets.ZED_ZIPPY_APP_ID }}
21 private-key: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
22 - name: steps::checkout_repo
23 uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
24 with:
25 clean: false
26 ref: ${{ inputs.branch }}
27 token: ${{ steps.generate-token.outputs.token }}
28 - id: channel
29 name: bump_patch_version::run_bump_patch_version::read_channel
30 run: |
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 "::error::must be run on a stable or preview release branch"
42 exit 1
43 ;;
44 esac
45
46 version=$(script/get-crate-version zed)
47
48 {
49 echo "channel=$channel"
50 echo "version=$version"
51 echo "tag_suffix=$tag_suffix"
52 } >> "$GITHUB_OUTPUT"
53 - name: bump_patch_version::run_bump_patch_version::verify_prior_release_exists
54 run: |
55 status=$(curl -s -o /dev/null -w '%{http_code}' "https://cloud.zed.dev/releases/$CHANNEL/$VERSION/asset?asset=zed&os=macos&arch=aarch64")
56 if [[ "$status" != "200" ]]; then
57 echo "::error::version $VERSION has not been released on $CHANNEL yet (HTTP $status) — bump the patch version only after the current version is released"
58 exit 1
59 fi
60 env:
61 CHANNEL: ${{ steps.channel.outputs.channel }}
62 VERSION: ${{ steps.channel.outputs.version }}
63 - name: steps::install_cargo_edit
64 uses: taiki-e/install-action@02cc5f8ca9f2301050c0c099055816a41ee05507
65 with:
66 tool: cargo-edit
67 - id: bump-version
68 name: bump_patch_version::run_bump_patch_version::bump_version
69 run: |
70 version="$(cargo set-version -p zed --bump patch 2>&1 | sed 's/.* //')"
71 echo "version=$version" >> "$GITHUB_OUTPUT"
72 - id: commit
73 name: steps::bot_commit
74 uses: IAreKyleW00t/verified-bot-commit@126a6a11889ab05bcff72ec2403c326cd249b84c
75 with:
76 message: Bump to ${{ steps.bump-version.outputs.version }} for @${{ github.actor }}
77 ref: refs/heads/${{ inputs.branch }}
78 files: '**'
79 token: ${{ steps.generate-token.outputs.token }}
80 - name: steps::create_tag
81 uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b
82 with:
83 script: |
84 github.rest.git.createRef({
85 owner: context.repo.owner,
86 repo: context.repo.repo,
87 ref: 'refs/tags/v${{ steps.bump-version.outputs.version }}${{ steps.channel.outputs.tag_suffix }}',
88 sha: '${{ steps.commit.outputs.commit }}'
89 })
90 github-token: ${{ steps.generate-token.outputs.token }}
91concurrency:
92 group: ${{ github.workflow }}-${{ inputs.branch }}
93 cancel-in-progress: true
94defaults:
95 run:
96 shell: bash -euxo pipefail {0}