Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Auto-release preview as Zippy (#45163)
Conrad Irwinf2d29f47906c
diff --git a/.github/workflows/autofix_pr.yml b/.github/workflows/autofix_pr.ymlindex 1591ba2a9a9..d3688a722aa 100644--- a/.github/workflows/autofix_pr.yml+++ b/.github/workflows/autofix_pr.yml@@ -90,7 +90,7 @@ jobs:runs-on: namespace-profile-2x4-ubuntu-2404steps:- id: get-app-token- name: autofix_pr::commit_changes::authenticate_as_zippy+ name: steps::authenticate_as_zippyuses: actions/create-github-app-token@bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1with:app-id: ${{ secrets.ZED_ZIPPY_APP_ID }}diff --git a/.github/workflows/cherry_pick.yml b/.github/workflows/cherry_pick.ymlindex bc01aae17e7..d4dee5154f2 100644--- a/.github/workflows/cherry_pick.yml+++ b/.github/workflows/cherry_pick.yml@@ -30,7 +30,7 @@ jobs:with:clean: false- id: get-app-token- name: cherry_pick::run_cherry_pick::authenticate_as_zippy+ name: steps::authenticate_as_zippyuses: actions/create-github-app-token@bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1with:app-id: ${{ secrets.ZED_ZIPPY_APP_ID }}diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 155b38666f4..8cc63340902 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -478,11 +478,17 @@ jobs:if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre')runs-on: namespace-profile-2x4-ubuntu-2404steps:+ - id: get-app-token+ name: steps::authenticate_as_zippy+ uses: actions/create-github-app-token@bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1+ with:+ app-id: ${{ secrets.ZED_ZIPPY_APP_ID }}+ private-key: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}- name: gh release edit "$GITHUB_REF_NAME" --repo=zed-industries/zed --draft=falserun: gh release edit "$GITHUB_REF_NAME" --repo=zed-industries/zed --draft=falseshell: bash -euxo pipefail {0}env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }}notify_on_failure:needs:- upload_release_assetsdiff --git a/tooling/xtask/src/tasks/workflows/autofix_pr.rs b/tooling/xtask/src/tasks/workflows/autofix_pr.rsindex f4a8e0e2b09..ab59e735225 100644--- a/tooling/xtask/src/tasks/workflows/autofix_pr.rs+++ b/tooling/xtask/src/tasks/workflows/autofix_pr.rs@@ -109,19 +109,6 @@ fn run_autofix(pr_number: &WorkflowInput, run_clippy: &WorkflowInput) -> NamedJo}fn commit_changes(pr_number: &WorkflowInput, autofix_job: &NamedJob) -> NamedJob {- fn authenticate_as_zippy() -> (Step<Use>, StepOutput) {- let step = named::uses(- "actions",- "create-github-app-token",- "bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1",- )- .add_with(("app-id", vars::ZED_ZIPPY_APP_ID))- .add_with(("private-key", vars::ZED_ZIPPY_APP_PRIVATE_KEY))- .id("get-app-token");- let output = StepOutput::new(&step, "token");- (step, output)- }-fn checkout_pr(pr_number: &WorkflowInput, token: &StepOutput) -> Step<Run> {named::bash(&format!("gh pr checkout {pr_number}")).add_env(("GITHUB_TOKEN", token))}@@ -148,7 +135,7 @@ fn commit_changes(pr_number: &WorkflowInput, autofix_job: &NamedJob) -> NamedJob.add_env(("GITHUB_TOKEN", token))}- let (authenticate, token) = authenticate_as_zippy();+ let (authenticate, token) = steps::authenticate_as_zippy();named::job(Job::default()diff --git a/tooling/xtask/src/tasks/workflows/cherry_pick.rs b/tooling/xtask/src/tasks/workflows/cherry_pick.rsindex 105bf74c419..eaa786837f8 100644--- a/tooling/xtask/src/tasks/workflows/cherry_pick.rs+++ b/tooling/xtask/src/tasks/workflows/cherry_pick.rs@@ -3,7 +3,7 @@ use gh_workflow::*;use crate::tasks::workflows::{runners,steps::{self, NamedJob, named},- vars::{self, StepOutput, WorkflowInput},+ vars::{StepOutput, WorkflowInput},};pub fn cherry_pick() -> Workflow {@@ -29,19 +29,6 @@ fn run_cherry_pick(commit: &WorkflowInput,channel: &WorkflowInput,) -> NamedJob {- fn authenticate_as_zippy() -> (Step<Use>, StepOutput) {- let step = named::uses(- "actions",- "create-github-app-token",- "bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1",- ) // v2- .add_with(("app-id", vars::ZED_ZIPPY_APP_ID))- .add_with(("private-key", vars::ZED_ZIPPY_APP_PRIVATE_KEY))- .id("get-app-token");- let output = StepOutput::new(&step, "token");- (step, output)- }-fn cherry_pick(branch: &WorkflowInput,commit: &WorkflowInput,@@ -54,7 +41,7 @@ fn run_cherry_pick(.add_env(("GITHUB_TOKEN", token))}- let (authenticate, token) = authenticate_as_zippy();+ let (authenticate, token) = steps::authenticate_as_zippy();named::job(Job::default()diff --git a/tooling/xtask/src/tasks/workflows/release.rs b/tooling/xtask/src/tasks/workflows/release.rsindex e06a7134019..80fb075f7f6 100644--- a/tooling/xtask/src/tasks/workflows/release.rs+++ b/tooling/xtask/src/tasks/workflows/release.rs@@ -97,17 +97,20 @@ pub(crate) fn create_sentry_release() -> Step<Use> {}fn auto_release_preview(deps: &[&NamedJob; 1]) -> NamedJob {+ let (authenticate, token) = steps::authenticate_as_zippy();+named::job(dependant_job(deps).runs_on(runners::LINUX_SMALL).cond(Expression::new(indoc::indoc!(r#"startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre')"#)))+ .add_step(authenticate).add_step(steps::script(r#"gh release edit "$GITHUB_REF_NAME" --repo=zed-industries/zed --draft=false"#,)- .add_env(("GITHUB_TOKEN", vars::GITHUB_TOKEN)),+ .add_env(("GITHUB_TOKEN", &token)),))}diff --git a/tooling/xtask/src/tasks/workflows/steps.rs b/tooling/xtask/src/tasks/workflows/steps.rsindex 54873c011ce..5ff7c0cae3c 100644--- a/tooling/xtask/src/tasks/workflows/steps.rs+++ b/tooling/xtask/src/tasks/workflows/steps.rs@@ -354,3 +354,16 @@ pub fn trigger_autofix(run_clippy: bool) -> Step<Run> {)).add_env(("GITHUB_TOKEN", vars::GITHUB_TOKEN))}++pub fn authenticate_as_zippy() -> (Step<Use>, StepOutput) {+ let step = named::uses(+ "actions",+ "create-github-app-token",+ "bef1eaf1c0ac2b148ee2a0a74c65fbe6db0631f1",+ )+ .add_with(("app-id", vars::ZED_ZIPPY_APP_ID))+ .add_with(("private-key", vars::ZED_ZIPPY_APP_PRIVATE_KEY))+ .id("get-app-token");+ let output = StepOutput::new(&step, "token");+ (step, output)+}