Skip to repository content102 lines · 3.4 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T05:38:22.462Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
bump_patch_version.rs
1use gh_workflow::*;
2
3use crate::tasks::workflows::{
4 runners,
5 steps::{self, CheckoutStep, CommonJobConditions, CommonPermissionSets, named},
6 vars::{StepOutput, WorkflowInput},
7};
8
9pub fn bump_patch_version() -> Workflow {
10 let branch = WorkflowInput::string("branch", None).description("Branch name to run on");
11 let bump_patch_version_job = run_bump_patch_version(&branch);
12 named::workflow()
13 .with_minimal_permissions()
14 .on(Event::default()
15 .workflow_dispatch(WorkflowDispatch::default().add_input(branch.name, branch.input())))
16 .concurrency(
17 Concurrency::new(Expression::new(format!(
18 "${{{{ github.workflow }}}}-{branch}"
19 )))
20 .cancel_in_progress(true),
21 )
22 .add_job(bump_patch_version_job.name, bump_patch_version_job.job)
23}
24
25fn run_bump_patch_version(branch: &WorkflowInput) -> steps::NamedJob {
26 fn checkout_branch(branch: &WorkflowInput, token: &StepOutput) -> CheckoutStep {
27 steps::checkout_repo()
28 .with_token(token)
29 .with_ref(branch.to_string())
30 }
31
32 fn read_channel() -> Step<Run> {
33 named::bash(indoc::indoc! {r#"
34 channel="$(cat crates/zed/RELEASE_CHANNEL)"
35
36 tag_suffix=""
37 case $channel in
38 stable)
39 ;;
40 preview)
41 tag_suffix="-pre"
42 ;;
43 *)
44 echo "::error::must be run on a stable or preview release branch"
45 exit 1
46 ;;
47 esac
48
49 version=$(script/get-crate-version zed)
50
51 {
52 echo "channel=$channel"
53 echo "version=$version"
54 echo "tag_suffix=$tag_suffix"
55 } >> "$GITHUB_OUTPUT"
56 "#})
57 .id("channel")
58 }
59
60 fn bump_version() -> Step<Run> {
61 named::bash(indoc::indoc! {r#"
62 version="$(cargo set-version -p zed --bump patch 2>&1 | sed 's/.* //')"
63 echo "version=$version" >> "$GITHUB_OUTPUT"
64 "#})
65 .id("bump-version")
66 }
67
68 let (authenticate, token) = steps::authenticate_as_zippy()
69 .for_repository(steps::RepositoryTarget::current())
70 .with_permissions([(steps::TokenPermissions::Contents, Level::Write)])
71 .into();
72 let channel_step = read_channel();
73 let tag_suffix = StepOutput::new(&channel_step, "tag_suffix");
74 let bump_version_step = bump_version();
75 let version = StepOutput::new(&bump_version_step, "version");
76 let commit_step: Step<Use> = steps::BotCommitStep::new(
77 format!("Bump to {version} for @${{{{ github.actor }}}}"),
78 branch,
79 &token,
80 )
81 .into();
82 let commit_sha = StepOutput::new_unchecked(&commit_step, "commit");
83
84 named::job(
85 Job::default()
86 .with_repository_owner_guard()
87 .permissions(Permissions::default().contents(Level::Write))
88 .runs_on(runners::LINUX_DEFAULT)
89 .add_step(authenticate)
90 .add_step(checkout_branch(branch, &token))
91 .add_step(channel_step)
92 .add_step(steps::install_cargo_edit())
93 .add_step(bump_version_step)
94 .add_step(commit_step)
95 .add_step(steps::create_ref(
96 steps::GitRef::tag(format!("v{version}{tag_suffix}")),
97 &commit_sha,
98 &token,
99 )),
100 )
101}
102