ci.yml

  1name: CI
  2
  3on:
  4  push:
  5    branches:
  6      - main
  7      - "v[0-9]+.[0-9]+.x"
  8    tags:
  9      - "v*"
 10
 11  pull_request:
 12    branches:
 13      - "**"
 14
 15concurrency:
 16  # Allow only one workflow per any non-`main` branch.
 17  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
 18  cancel-in-progress: true
 19
 20env:
 21  CARGO_TERM_COLOR: always
 22  CARGO_INCREMENTAL: 0
 23  RUST_BACKTRACE: 1
 24
 25jobs:
 26  job_spec:
 27    name: Decide which jobs to run
 28    if: github.repository_owner == 'zed-industries'
 29    outputs:
 30      run_tests: ${{ steps.filter.outputs.run_tests }}
 31      run_license: ${{ steps.filter.outputs.run_license }}
 32    runs-on:
 33      - ubuntu-latest
 34    steps:
 35      - name: Checkout repo
 36        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 37        with:
 38          # 350 is arbitrary; ~10days of history on main (5secs); full history is ~25secs
 39          fetch-depth: ${{ github.ref == 'refs/heads/main' && 2 || 350 }}
 40      - name: Fetch git history and generate output filters
 41        id: filter
 42        run: |
 43          if [ -z "$GITHUB_BASE_REF" ]; then
 44            echo "Not in a PR context (i.e., push to main/stable/preview)"
 45            COMPARE_REV=$(git rev-parse HEAD~1)
 46          else
 47            echo "In a PR context comparing to pull_request.base.ref"
 48            git fetch origin "$GITHUB_BASE_REF" --depth=350
 49            COMPARE_REV=$(git merge-base "origin/${GITHUB_BASE_REF}" HEAD)
 50          fi
 51          # Specify anything which should skip full CI in this regex:
 52          # - docs/
 53          # - .github/ISSUE_TEMPLATE/
 54          # - .github/workflows/  (except .github/workflows/ci.yml)
 55          SKIP_REGEX='^(docs/|\.github/(ISSUE_TEMPLATE|workflows/(?!ci)))'
 56          if [[ $(git diff --name-only $COMPARE_REV ${{ github.sha }} | grep -vP "$SKIP_REGEX") ]]; then
 57            echo "run_tests=true" >> $GITHUB_OUTPUT
 58          else
 59            echo "run_tests=false" >> $GITHUB_OUTPUT
 60          fi
 61          if [[ $(git diff --name-only $COMPARE_REV ${{ github.sha }} | grep '^Cargo.lock') ]]; then
 62            echo "run_license=true" >> $GITHUB_OUTPUT
 63          else
 64            echo "run_license=false" >> $GITHUB_OUTPUT
 65          fi
 66
 67  migration_checks:
 68    name: Check Postgres and Protobuf migrations, mergability
 69    needs: [job_spec]
 70    if: |
 71      github.repository_owner == 'zed-industries' &&
 72      needs.job_spec.outputs.run_tests == 'true'
 73    timeout-minutes: 60
 74    runs-on:
 75      - self-hosted
 76      - test
 77    steps:
 78      - name: Checkout repo
 79        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 80        with:
 81          clean: false
 82          fetch-depth: 0 # fetch full history
 83
 84      - name: Remove untracked files
 85        run: git clean -df
 86
 87      - name: Find modified migrations
 88        shell: bash -euxo pipefail {0}
 89        run: |
 90          export SQUAWK_GITHUB_TOKEN=${{ github.token }}
 91          . ./script/squawk
 92
 93      - name: Ensure fresh merge
 94        shell: bash -euxo pipefail {0}
 95        run: |
 96          if [ -z "$GITHUB_BASE_REF" ];
 97          then
 98            echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> $GITHUB_ENV
 99          else
100            git checkout -B temp
101            git merge -q origin/$GITHUB_BASE_REF -m "merge main into temp"
102            echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> $GITHUB_ENV
103          fi
104
105      - uses: bufbuild/buf-setup-action@v1
106        with:
107          version: v1.29.0
108      - uses: bufbuild/buf-breaking-action@v1
109        with:
110          input: "crates/proto/proto/"
111          against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"
112
113  workspace_hack:
114    timeout-minutes: 60
115    name: Check workspace-hack crate
116    needs: [job_spec]
117    if: |
118      github.repository_owner == 'zed-industries' &&
119      needs.job_spec.outputs.run_tests == 'true'
120    runs-on:
121      - buildjet-8vcpu-ubuntu-2204
122    steps:
123      - name: Checkout repo
124        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
125      - name: Add Rust to the PATH
126        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
127      - name: Install cargo-hakari
128        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
129        with:
130          command: install
131          args: cargo-hakari@0.9.35
132
133      - name: Check workspace-hack Cargo.toml is up-to-date
134        run: |
135          cargo hakari generate --diff || {
136            echo "To fix, run script/update-workspace-hack or script/update-workspace-hack.ps1";
137            false
138          }
139      - name: Check all crates depend on workspace-hack
140        run: |
141          cargo hakari manage-deps --dry-run || {
142            echo "To fix, run script/update-workspace-hack or script/update-workspace-hack.ps1"
143            false
144          }
145
146  style:
147    timeout-minutes: 60
148    name: Check formatting and spelling
149    needs: [job_spec]
150    if: github.repository_owner == 'zed-industries'
151    runs-on:
152      - buildjet-8vcpu-ubuntu-2204
153    steps:
154      - name: Checkout repo
155        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
156
157      - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
158        with:
159          version: 9
160
161      - name: Prettier Check on /docs
162        working-directory: ./docs
163        run: |
164          pnpm dlx prettier@${PRETTIER_VERSION} . --check || {
165            echo "To fix, run from the root of the Zed repo:"
166            echo "  cd docs && pnpm dlx prettier@${PRETTIER_VERSION} . --write && cd .."
167            false
168          }
169        env:
170          PRETTIER_VERSION: 3.5.0
171
172      - name: Prettier Check on default.json
173        run: |
174          pnpm dlx prettier@${PRETTIER_VERSION} assets/settings/default.json --check || {
175            echo "To fix, run from the root of the Zed repo:"
176            echo "  pnpm dlx prettier@${PRETTIER_VERSION} assets/settings/default.json --write"
177            false
178          }
179        env:
180          PRETTIER_VERSION: 3.5.0
181
182      # To support writing comments that they will certainly be revisited.
183      - name: Check for todo! and FIXME comments
184        run: script/check-todos
185
186      - name: Run style checks
187        uses: ./.github/actions/check_style
188
189      - name: Check for typos
190        uses: crate-ci/typos@8e6a4285bcbde632c5d79900a7779746e8b7ea3f # v1.24.6
191        with:
192          config: ./typos.toml
193
194  macos_tests:
195    timeout-minutes: 60
196    name: (macOS) Run Clippy and tests
197    needs: [job_spec]
198    if: |
199      github.repository_owner == 'zed-industries' &&
200      needs.job_spec.outputs.run_tests == 'true'
201    runs-on:
202      - self-hosted
203      - test
204    steps:
205      - name: Checkout repo
206        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
207        with:
208          clean: false
209
210      - name: Configure CI
211        run: |
212          mkdir -p ./../.cargo
213          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
214
215      - name: cargo clippy
216        run: ./script/clippy
217
218      - name: Install cargo-machete
219        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
220        with:
221          command: install
222          args: cargo-machete@0.7.0
223
224      - name: Check unused dependencies
225        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
226        with:
227          command: machete
228
229      - name: Check licenses
230        run: |
231          script/check-licenses
232          if [[ "${{ needs.job_spec.outputs.run_license }}" == "true" ]]; then
233            script/generate-licenses /tmp/zed_licenses_output
234          fi
235
236      - name: Check for new vulnerable dependencies
237        if: github.event_name == 'pull_request'
238        uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8 # v4
239        with:
240          license-check: false
241
242      - name: Run tests
243        uses: ./.github/actions/run_tests
244
245      - name: Build collab
246        run: cargo build -p collab
247
248      - name: Build other binaries and features
249        run: |
250          cargo build --workspace --bins --all-features
251          cargo check -p gpui --features "macos-blade"
252          cargo check -p workspace
253          cargo build -p remote_server
254          cargo check -p gpui --examples
255
256      # Since the macOS runners are stateful, so we need to remove the config file to prevent potential bug.
257      - name: Clean CI config file
258        if: always()
259        run: rm -rf ./../.cargo
260
261  linux_tests:
262    timeout-minutes: 60
263    name: (Linux) Run Clippy and tests
264    needs: [job_spec]
265    if: |
266      github.repository_owner == 'zed-industries' &&
267      needs.job_spec.outputs.run_tests == 'true'
268    runs-on:
269      - buildjet-16vcpu-ubuntu-2204
270    steps:
271      - name: Add Rust to the PATH
272        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
273
274      - name: Checkout repo
275        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
276        with:
277          clean: false
278
279      - name: Cache dependencies
280        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
281        with:
282          save-if: ${{ github.ref == 'refs/heads/main' }}
283          cache-provider: "buildjet"
284
285      - name: Install Linux dependencies
286        run: ./script/linux
287
288      - name: Configure CI
289        run: |
290          mkdir -p ./../.cargo
291          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
292
293      - name: cargo clippy
294        run: ./script/clippy
295
296      - name: Run tests
297        uses: ./.github/actions/run_tests
298
299      - name: Build other binaries and features
300        run: |
301          cargo build -p zed
302          cargo check -p workspace
303          cargo check -p gpui --examples
304
305      # Even the Linux runner is not stateful, in theory there is no need to do this cleanup.
306      # But, to avoid potential issues in the future if we choose to use a stateful Linux runner and forget to add code
307      # to clean up the config file, I’ve included the cleanup code here as a precaution.
308      # While it’s not strictly necessary at this moment, I believe it’s better to err on the side of caution.
309      - name: Clean CI config file
310        if: always()
311        run: rm -rf ./../.cargo
312
313  build_remote_server:
314    timeout-minutes: 60
315    name: (Linux) Build Remote Server
316    needs: [job_spec]
317    if: |
318      github.repository_owner == 'zed-industries' &&
319      needs.job_spec.outputs.run_tests == 'true'
320    runs-on:
321      - buildjet-8vcpu-ubuntu-2204
322    steps:
323      - name: Add Rust to the PATH
324        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
325
326      - name: Checkout repo
327        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
328        with:
329          clean: false
330
331      - name: Cache dependencies
332        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
333        with:
334          save-if: ${{ github.ref == 'refs/heads/main' }}
335          cache-provider: "buildjet"
336
337      - name: Install Clang & Mold
338        run: ./script/remote-server && ./script/install-mold 2.34.0
339
340      - name: Configure CI
341        run: |
342          mkdir -p ./../.cargo
343          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
344
345      - name: Build Remote Server
346        run: cargo build -p remote_server
347
348      - name: Clean CI config file
349        if: always()
350        run: rm -rf ./../.cargo
351
352  windows_clippy:
353    timeout-minutes: 60
354    name: (Windows) Run Clippy
355    needs: [job_spec]
356    if: |
357      github.repository_owner == 'zed-industries' &&
358      needs.job_spec.outputs.run_tests == 'true'
359    runs-on: windows-2025-16
360    steps:
361      # more info here:- https://github.com/rust-lang/cargo/issues/13020
362      - name: Enable longer pathnames for git
363        run: git config --system core.longpaths true
364
365      - name: Checkout repo
366        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
367        with:
368          clean: false
369
370      - name: Create Dev Drive using ReFS
371        run: ./script/setup-dev-driver.ps1
372
373      # actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
374      - name: Copy Git Repo to Dev Drive
375        run: |
376          Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
377
378      - name: Cache dependencies
379        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
380        with:
381          save-if: ${{ github.ref == 'refs/heads/main' }}
382          workspaces: ${{ env.ZED_WORKSPACE }}
383          cache-provider: "github"
384
385      - name: Configure CI
386        run: |
387          mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
388          cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
389
390      - name: cargo clippy
391        working-directory: ${{ env.ZED_WORKSPACE }}
392        run: ./script/clippy.ps1
393
394      - name: Check dev drive space
395        working-directory: ${{ env.ZED_WORKSPACE }}
396        # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
397        run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
398
399      # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
400      - name: Clean CI config file
401        if: always()
402        run: |
403          if (Test-Path "${{ env.CARGO_HOME }}/config.toml") {
404            Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml"  -Force
405          }
406
407  # Windows CI takes twice as long as our other platforms and fast github hosted runners are expensive.
408  # But we still want to do CI, so let's only run tests on main and come back to this when we're
409  # ready to self host our Windows CI (e.g. during the push for full Windows support)
410  windows_tests:
411    timeout-minutes: 60
412    name: (Windows) Run Tests
413    needs: [job_spec]
414    if: |
415      github.repository_owner == 'zed-industries' &&
416      needs.job_spec.outputs.run_tests == 'true'
417    # Use bigger runners for PRs (speed); smaller for async (cost)
418    runs-on: ${{ github.event_name == 'pull_request' && 'windows-2025-32' || 'windows-2025-16' }}
419    steps:
420      # more info here:- https://github.com/rust-lang/cargo/issues/13020
421      - name: Enable longer pathnames for git
422        run: git config --system core.longpaths true
423
424      - name: Checkout repo
425        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
426        with:
427          clean: false
428
429      - name: Create Dev Drive using ReFS
430        run: ./script/setup-dev-driver.ps1
431
432      # actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
433      - name: Copy Git Repo to Dev Drive
434        run: |
435          Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
436
437      - name: Cache dependencies
438        uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
439        with:
440          save-if: ${{ github.ref == 'refs/heads/main' }}
441          workspaces: ${{ env.ZED_WORKSPACE }}
442          cache-provider: "github"
443
444      - name: Configure CI
445        run: |
446          mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
447          cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
448
449      - name: Run tests
450        uses: ./.github/actions/run_tests_windows
451        with:
452          working-directory: ${{ env.ZED_WORKSPACE }}
453
454      - name: Build Zed
455        working-directory: ${{ env.ZED_WORKSPACE }}
456        run: cargo build
457
458      - name: Check dev drive space
459        working-directory: ${{ env.ZED_WORKSPACE }}
460        # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
461        run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
462
463      # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
464      - name: Clean CI config file
465        if: always()
466        run: |
467          if (Test-Path "${{ env.CARGO_HOME }}/config.toml") {
468            Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml"  -Force
469          }
470
471  tests_pass:
472    name: Tests Pass
473    runs-on: ubuntu-latest
474    needs:
475      - job_spec
476      - style
477      - migration_checks
478      # run_tests: If adding required tests, add them here and to script below.
479      - workspace_hack
480      - linux_tests
481      - build_remote_server
482      - macos_tests
483      - windows_clippy
484      - windows_tests
485    if: |
486      github.repository_owner == 'zed-industries' &&
487      always()
488    steps:
489      - name: Check all tests passed
490        run: |
491          # Check dependent jobs...
492          RET_CODE=0
493          # Always check style
494          [[ "${{ needs.style.result }}" != 'success' ]] && { RET_CODE=1; echo "style tests failed"; }
495
496          # Only check test jobs if they were supposed to run
497          if [[ "${{ needs.job_spec.outputs.run_tests }}" == "true" ]]; then
498            [[ "${{ needs.workspace_hack.result }}"       != 'success' ]] && { RET_CODE=1; echo "Workspace Hack failed"; }
499            [[ "${{ needs.macos_tests.result }}"          != 'success' ]] && { RET_CODE=1; echo "macOS tests failed"; }
500            [[ "${{ needs.linux_tests.result }}"          != 'success' ]] && { RET_CODE=1; echo "Linux tests failed"; }
501            [[ "${{ needs.windows_tests.result }}"        != 'success' ]] && { RET_CODE=1; echo "Windows tests failed"; }
502            [[ "${{ needs.windows_clippy.result }}"       != 'success' ]] && { RET_CODE=1; echo "Windows clippy failed"; }
503            [[ "${{ needs.build_remote_server.result }}"  != 'success' ]] && { RET_CODE=1; echo "Remote server build failed"; }
504            # This check is intentionally disabled. See: https://github.com/zed-industries/zed/pull/28431
505            # [[ "${{ needs.migration_checks.result }}"     != 'success' ]] && { RET_CODE=1; echo "Migration Checks failed"; }
506          fi
507          if [[ "$RET_CODE" -eq 0 ]]; then
508            echo "All tests passed successfully!"
509          fi
510          exit $RET_CODE
511
512  bundle-mac:
513    timeout-minutes: 120
514    name: Create a macOS bundle
515    runs-on:
516      - self-hosted
517      - bundle
518    if: |
519      startsWith(github.ref, 'refs/tags/v')
520      || contains(github.event.pull_request.labels.*.name, 'run-bundling')
521    needs: [macos_tests]
522    env:
523      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
524      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
525      APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
526      APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
527      APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
528      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
529      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
530      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
531    steps:
532      - name: Install Node
533        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
534        with:
535          node-version: "18"
536
537      - name: Checkout repo
538        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
539        with:
540          # We need to fetch more than one commit so that `script/draft-release-notes`
541          # is able to diff between the current and previous tag.
542          #
543          # 25 was chosen arbitrarily.
544          fetch-depth: 25
545          clean: false
546          ref: ${{ github.ref }}
547
548      - name: Limit target directory size
549        run: script/clear-target-dir-if-larger-than 100
550
551      - name: Determine version and release channel
552        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
553        run: |
554          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
555          script/determine-release-channel
556
557      - name: Draft release notes
558        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
559        run: |
560          mkdir -p target/
561          # Ignore any errors that occur while drafting release notes to not fail the build.
562          script/draft-release-notes "$RELEASE_VERSION" "$RELEASE_CHANNEL" > target/release-notes.md || true
563          script/create-draft-release target/release-notes.md
564        env:
565          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
566
567      - name: Create macOS app bundle
568        run: script/bundle-mac
569
570      - name: Rename binaries
571        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
572        run: |
573          mv target/aarch64-apple-darwin/release/Zed.dmg target/aarch64-apple-darwin/release/Zed-aarch64.dmg
574          mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
575
576      - name: Upload app bundle (aarch64) to workflow run if main branch or specific label
577        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
578        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
579        with:
580          name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
581          path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg
582
583      - name: Upload app bundle (x86_64) to workflow run if main branch or specific label
584        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
585        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
586        with:
587          name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
588          path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg
589
590      - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
591        name: Upload app bundle to release
592        if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
593        with:
594          draft: true
595          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
596          files: |
597            target/zed-remote-server-macos-x86_64.gz
598            target/zed-remote-server-macos-aarch64.gz
599            target/aarch64-apple-darwin/release/Zed-aarch64.dmg
600            target/x86_64-apple-darwin/release/Zed-x86_64.dmg
601        env:
602          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
603
604  bundle-linux-x86_x64:
605    timeout-minutes: 60
606    name: Linux x86_x64 release bundle
607    runs-on:
608      - buildjet-16vcpu-ubuntu-2004 # ubuntu 20.04 for minimal glibc
609    if: |
610      startsWith(github.ref, 'refs/tags/v')
611      || contains(github.event.pull_request.labels.*.name, 'run-bundling')
612    needs: [linux_tests]
613    env:
614      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
615      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
616      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
617    steps:
618      - name: Checkout repo
619        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
620        with:
621          clean: false
622
623      - name: Install Linux dependencies
624        run: ./script/linux && ./script/install-mold 2.34.0
625
626      - name: Determine version and release channel
627        if: startsWith(github.ref, 'refs/tags/v')
628        run: |
629          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
630          script/determine-release-channel
631
632      - name: Create Linux .tar.gz bundle
633        run: script/bundle-linux
634
635      - name: Upload Artifact to Workflow - zed (run-bundling)
636        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
637        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
638        with:
639          name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz
640          path: target/release/zed-*.tar.gz
641
642      - name: Upload Artifact to Workflow - zed-remote-server (run-bundling)
643        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
644        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
645        with:
646          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.gz
647          path: target/zed-remote-server-linux-x86_64.gz
648
649      - name: Upload Artifacts to release
650        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
651        if: ${{ !(contains(github.event.pull_request.labels.*.name, 'run-bundling')) }}
652        with:
653          draft: true
654          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
655          files: |
656            target/zed-remote-server-linux-x86_64.gz
657            target/release/zed-linux-x86_64.tar.gz
658        env:
659          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
660
661  bundle-linux-aarch64: # this runs on ubuntu22.04
662    timeout-minutes: 60
663    name: Linux arm64 release bundle
664    runs-on:
665      - buildjet-16vcpu-ubuntu-2204-arm
666    if: |
667      startsWith(github.ref, 'refs/tags/v')
668      || contains(github.event.pull_request.labels.*.name, 'run-bundling')
669    needs: [linux_tests]
670    env:
671      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
672      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
673      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
674    steps:
675      - name: Checkout repo
676        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
677        with:
678          clean: false
679
680      - name: Install Linux dependencies
681        run: ./script/linux
682
683      - name: Determine version and release channel
684        if: startsWith(github.ref, 'refs/tags/v')
685        run: |
686          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
687          script/determine-release-channel
688
689      - name: Create and upload Linux .tar.gz bundles
690        run: script/bundle-linux
691
692      - name: Upload Artifact to Workflow - zed (run-bundling)
693        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
694        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
695        with:
696          name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
697          path: target/release/zed-*.tar.gz
698
699      - name: Upload Artifact to Workflow - zed-remote-server (run-bundling)
700        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
701        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
702        with:
703          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.gz
704          path: target/zed-remote-server-linux-aarch64.gz
705
706      - name: Upload Artifacts to release
707        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
708        if: ${{ !(contains(github.event.pull_request.labels.*.name, 'run-bundling')) }}
709        with:
710          draft: true
711          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
712          files: |
713            target/zed-remote-server-linux-aarch64.gz
714            target/release/zed-linux-aarch64.tar.gz
715        env:
716          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
717
718  nix-build:
719    name: Build with Nix
720    uses: ./.github/workflows/nix.yml
721    if: github.repository_owner == 'zed-industries' && contains(github.event.pull_request.labels.*.name, 'run-nix')
722    with:
723      flake-output: debug
724      # excludes the final package to only cache dependencies
725      cachix-filter: "-zed-editor-[0-9.]*-nightly"
726
727  auto-release-preview:
728    name: Auto release preview
729    if: |
730      startsWith(github.ref, 'refs/tags/v')
731      && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre')
732    needs: [bundle-mac, bundle-linux-x86_x64, bundle-linux-aarch64]
733    runs-on:
734      - self-hosted
735      - bundle
736    steps:
737      - name: gh release
738        run: gh release edit $GITHUB_REF_NAME --draft=true
739        env:
740          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}