diff --git a/.github/workflows/bump_patch_version.yml b/.github/workflows/bump_patch_version.yml index a12a1f5e43..3618d7230f 100644 --- a/.github/workflows/bump_patch_version.yml +++ b/.github/workflows/bump_patch_version.yml @@ -50,16 +50,6 @@ jobs: echo "version=$version" echo "tag_suffix=$tag_suffix" } >> "$GITHUB_OUTPUT" - - name: bump_patch_version::run_bump_patch_version::verify_prior_release_exists - run: | - status=$(curl -s -o /dev/null -w '%{http_code}' "https://cloud.zed.dev/releases/$CHANNEL/$VERSION/asset?asset=zed&os=macos&arch=aarch64") - if [[ "$status" != "200" ]]; then - echo "::error::version $VERSION has not been released on $CHANNEL yet (HTTP $status) — bump the patch version only after the current version is released" - exit 1 - fi - env: - CHANNEL: ${{ steps.channel.outputs.channel }} - VERSION: ${{ steps.channel.outputs.version }} - name: steps::install_cargo_edit uses: taiki-e/install-action@02cc5f8ca9f2301050c0c099055816a41ee05507 with: diff --git a/.github/workflows/retag_release.yml b/.github/workflows/retag_release.yml deleted file mode 100644 index 0cd3710ba3..0000000000 --- a/.github/workflows/retag_release.yml +++ /dev/null @@ -1,88 +0,0 @@ -# Generated from xtask::workflows::retag_release -# Rebuild with `cargo xtask workflows`. -name: retag_release -on: - workflow_dispatch: - inputs: - branch: - description: Release branch to re-tag (e.g. v0.180.x) - required: true - type: string -jobs: - run_retag_release: - if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') - runs-on: namespace-profile-16x32-ubuntu-2204 - steps: - - id: generate-token - name: steps::authenticate_as_zippy - uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 - with: - app-id: ${{ secrets.ZED_ZIPPY_APP_ID }} - private-key: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }} - - name: steps::checkout_repo - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd - with: - clean: false - ref: ${{ inputs.branch }} - token: ${{ steps.generate-token.outputs.token }} - - id: info - name: retag_release::run_retag_release::resolve_tag - run: | - if [[ ! "$BRANCH" =~ ^v[0-9]+\.[0-9]{1,3}\.x$ ]]; then - echo "::error::branch '$BRANCH' does not match the release branch pattern v[N].[N].x" - exit 1 - fi - - channel="$(cat crates/zed/RELEASE_CHANNEL)" - - tag_suffix="" - case $channel in - stable) - ;; - preview) - tag_suffix="-pre" - ;; - *) - echo "::error::must be run on a stable or preview release branch" - exit 1 - ;; - esac - - version=$(script/get-crate-version zed) - - { - echo "channel=$channel" - echo "version=$version" - echo "tag_suffix=$tag_suffix" - echo "head_sha=$(git rev-parse HEAD)" - } >> "$GITHUB_OUTPUT" - env: - BRANCH: ${{ inputs.branch }} - - name: retag_release::run_retag_release::verify_no_existing_release - run: | - status=$(curl -s -o /dev/null -w '%{http_code}' "https://cloud.zed.dev/releases/$CHANNEL/$VERSION/asset?asset=zed&os=macos&arch=aarch64") - if [[ "$status" == "200" ]]; then - echo "::error::version $VERSION is already released on $CHANNEL — cannot re-tag a released version" - exit 1 - fi - env: - CHANNEL: ${{ steps.info.outputs.channel }} - VERSION: ${{ steps.info.outputs.version }} - - name: steps::update_tag - uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b - with: - script: | - github.rest.git.updateRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'tags/v${{ steps.info.outputs.version }}${{ steps.info.outputs.tag_suffix }}', - sha: '${{ steps.info.outputs.head_sha }}', - force: true - }) - github-token: ${{ steps.generate-token.outputs.token }} -concurrency: - group: ${{ github.workflow }}-${{ inputs.branch }} - cancel-in-progress: true -defaults: - run: - shell: bash -euxo pipefail {0} diff --git a/script/retag-release b/script/retag-release deleted file mode 100755 index f7097e1994..0000000000 --- a/script/retag-release +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -usage() { - echo "Usage: $0 " - echo "" - echo "Re-tags the HEAD of a release branch by force-updating the tag." - echo "This is useful when commits were added to a release branch after" - echo "tagging but before the release was published." - echo "" - echo "Arguments:" - echo " branch Release branch name (e.g. v0.180.x)" - exit 1 -} - -branch="${1:-}" - -if [[ -z "$branch" ]]; then - usage -fi - -which gh > /dev/null 2>&1 || { - echo "error: GitHub CLI (gh) is required but not installed." >&2 - echo "Install it with: brew install gh" >&2 - exit 1 -} - -echo "Triggering retag_release workflow:" -echo " branch: $branch" -echo "" - -gh workflow run retag_release.yml \ - -f branch="$branch" - -echo "" -echo "Workflow triggered. Monitor progress at:" -echo " https://github.com/zed-industries/zed/actions/workflows/retag_release.yml" diff --git a/tooling/xtask/src/tasks/workflows.rs b/tooling/xtask/src/tasks/workflows.rs index 69dd1b3d34..2e21363bb6 100644 --- a/tooling/xtask/src/tasks/workflows.rs +++ b/tooling/xtask/src/tasks/workflows.rs @@ -23,7 +23,6 @@ mod extensions; mod nix_build; mod publish_extension_cli; mod release_nightly; -mod retag_release; mod run_bundling; mod release; @@ -211,7 +210,6 @@ pub fn run_workflows(args: GenerateWorkflowArgs) -> Result<()> { WorkflowFile::zed(publish_extension_cli::publish_extension_cli), WorkflowFile::zed(release::release), WorkflowFile::zed(release_nightly::release_nightly), - WorkflowFile::zed(retag_release::retag_release), WorkflowFile::zed(run_agent_evals::run_cron_unit_evals), WorkflowFile::zed(run_agent_evals::run_unit_evals), WorkflowFile::zed(run_bundling::run_bundling), diff --git a/tooling/xtask/src/tasks/workflows/bump_patch_version.rs b/tooling/xtask/src/tasks/workflows/bump_patch_version.rs index a657e77f3d..fcff7418a2 100644 --- a/tooling/xtask/src/tasks/workflows/bump_patch_version.rs +++ b/tooling/xtask/src/tasks/workflows/bump_patch_version.rs @@ -56,18 +56,6 @@ fn run_bump_patch_version(branch: &WorkflowInput) -> steps::NamedJob { .id("channel") } - fn verify_prior_release_exists() -> Step { - named::bash(indoc::indoc! {r#" - status=$(curl -s -o /dev/null -w '%{http_code}' "https://cloud.zed.dev/releases/$CHANNEL/$VERSION/asset?asset=zed&os=macos&arch=aarch64") - if [[ "$status" != "200" ]]; then - echo "::error::version $VERSION has not been released on $CHANNEL yet (HTTP $status) — bump the patch version only after the current version is released" - exit 1 - fi - "#}) - .add_env(("CHANNEL", "${{ steps.channel.outputs.channel }}")) - .add_env(("VERSION", "${{ steps.channel.outputs.version }}")) - } - fn bump_version() -> Step { named::bash(indoc::indoc! {r#" version="$(cargo set-version -p zed --bump patch 2>&1 | sed 's/.* //')" @@ -96,7 +84,6 @@ fn run_bump_patch_version(branch: &WorkflowInput) -> steps::NamedJob { .add_step(authenticate) .add_step(checkout_branch(branch, &token)) .add_step(channel_step) - .add_step(verify_prior_release_exists()) .add_step(steps::install_cargo_edit()) .add_step(bump_version_step) .add_step(commit_step) diff --git a/tooling/xtask/src/tasks/workflows/retag_release.rs b/tooling/xtask/src/tasks/workflows/retag_release.rs deleted file mode 100644 index 98296a8f04..0000000000 --- a/tooling/xtask/src/tasks/workflows/retag_release.rs +++ /dev/null @@ -1,100 +0,0 @@ -use gh_workflow::*; - -use crate::tasks::workflows::{ - runners, - steps::{self, CheckoutStep, CommonJobConditions, named}, - vars::{StepOutput, WorkflowInput}, -}; - -pub fn retag_release() -> Workflow { - let branch = WorkflowInput::string("branch", None) - .description("Release branch to re-tag (e.g. v0.180.x)"); - let retag_job = run_retag_release(&branch); - named::workflow() - .on(Event::default() - .workflow_dispatch(WorkflowDispatch::default().add_input(branch.name, branch.input()))) - .concurrency( - Concurrency::new(Expression::new(format!( - "${{{{ github.workflow }}}}-{branch}" - ))) - .cancel_in_progress(true), - ) - .add_job(retag_job.name, retag_job.job) -} - -fn run_retag_release(branch: &WorkflowInput) -> steps::NamedJob { - fn checkout_branch(branch: &WorkflowInput, token: &StepOutput) -> CheckoutStep { - steps::checkout_repo() - .with_token(token) - .with_ref(branch.to_string()) - } - - fn resolve_tag(branch: &WorkflowInput) -> Step { - named::bash(indoc::indoc! {r#" - if [[ ! "$BRANCH" =~ ^v[0-9]+\.[0-9]{1,3}\.x$ ]]; then - echo "::error::branch '$BRANCH' does not match the release branch pattern v[N].[N].x" - exit 1 - fi - - channel="$(cat crates/zed/RELEASE_CHANNEL)" - - tag_suffix="" - case $channel in - stable) - ;; - preview) - tag_suffix="-pre" - ;; - *) - echo "::error::must be run on a stable or preview release branch" - exit 1 - ;; - esac - - version=$(script/get-crate-version zed) - - { - echo "channel=$channel" - echo "version=$version" - echo "tag_suffix=$tag_suffix" - echo "head_sha=$(git rev-parse HEAD)" - } >> "$GITHUB_OUTPUT" - "#}) - .id("info") - .add_env(("BRANCH", branch.to_string())) - } - - fn verify_no_existing_release() -> Step { - named::bash(indoc::indoc! {r#" - status=$(curl -s -o /dev/null -w '%{http_code}' "https://cloud.zed.dev/releases/$CHANNEL/$VERSION/asset?asset=zed&os=macos&arch=aarch64") - if [[ "$status" == "200" ]]; then - echo "::error::version $VERSION is already released on $CHANNEL — cannot re-tag a released version" - exit 1 - fi - "#}) - .add_env(("CHANNEL", "${{ steps.info.outputs.channel }}")) - .add_env(("VERSION", "${{ steps.info.outputs.version }}")) - } - - let (authenticate, token) = steps::authenticate_as_zippy().into(); - let resolve_step = resolve_tag(branch); - let version = StepOutput::new(&resolve_step, "version"); - let tag_suffix = StepOutput::new(&resolve_step, "tag_suffix"); - let head_sha = StepOutput::new(&resolve_step, "head_sha"); - - named::job( - Job::default() - .with_repository_owner_guard() - .runs_on(runners::LINUX_XL) - .add_step(authenticate) - .add_step(checkout_branch(branch, &token)) - .add_step(resolve_step) - .add_step(verify_no_existing_release()) - .add_step(steps::update_ref( - steps::GitRef::tag(format!("v{version}{tag_suffix}")), - &head_sha, - &token, - true, - )), - ) -}