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  migration_checks:
 27    name: Check Postgres and Protobuf migrations, mergability
 28    if: github.repository_owner == 'zed-industries'
 29    timeout-minutes: 60
 30    runs-on:
 31      - self-hosted
 32      - test
 33    steps:
 34      - name: Checkout repo
 35        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 36        with:
 37          clean: false
 38          fetch-depth: 0 # fetch full history
 39
 40      - name: Remove untracked files
 41        run: git clean -df
 42
 43      - name: Find modified migrations
 44        shell: bash -euxo pipefail {0}
 45        run: |
 46          export SQUAWK_GITHUB_TOKEN=${{ github.token }}
 47          . ./script/squawk
 48
 49      - name: Ensure fresh merge
 50        shell: bash -euxo pipefail {0}
 51        run: |
 52          if [ -z "$GITHUB_BASE_REF" ];
 53          then
 54            echo "BUF_BASE_BRANCH=$(git merge-base origin/main HEAD)" >> $GITHUB_ENV
 55          else
 56            git checkout -B temp
 57            git merge -q origin/$GITHUB_BASE_REF -m "merge main into temp"
 58            echo "BUF_BASE_BRANCH=$GITHUB_BASE_REF" >> $GITHUB_ENV
 59          fi
 60
 61      - uses: bufbuild/buf-setup-action@v1
 62        with:
 63          version: v1.29.0
 64      - uses: bufbuild/buf-breaking-action@v1
 65        with:
 66          input: "crates/proto/proto/"
 67          against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"
 68
 69  style:
 70    timeout-minutes: 60
 71    name: Check formatting and spelling
 72    if: github.repository_owner == 'zed-industries'
 73    runs-on:
 74      - buildjet-8vcpu-ubuntu-2204
 75    steps:
 76      - name: Checkout repo
 77        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 78
 79      # To support writing comments that they will certainly be revisited.
 80      - name: Check for todo! and FIXME comments
 81        run: script/check-todos
 82
 83      - name: Run style checks
 84        uses: ./.github/actions/check_style
 85
 86      - name: Check for typos
 87        uses: crate-ci/typos@8e6a4285bcbde632c5d79900a7779746e8b7ea3f # v1.24.6
 88        with:
 89          config: ./typos.toml
 90
 91  macos_tests:
 92    timeout-minutes: 60
 93    name: (macOS) Run Clippy and tests
 94    if: github.repository_owner == 'zed-industries'
 95    runs-on:
 96      - self-hosted
 97      - test
 98    steps:
 99      - name: Checkout repo
100        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
101        with:
102          clean: false
103
104      - name: Configure CI
105        run: |
106          mkdir -p ./../.cargo
107          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
108
109      - name: cargo clippy
110        run: ./script/clippy
111
112      - name: Install cargo-machete
113        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
114        with:
115          command: install
116          args: cargo-machete@0.7.0
117
118      - name: Check unused dependencies
119        uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 # v2
120        with:
121          command: machete
122
123      - name: Check licenses
124        run: |
125          script/check-licenses
126          script/generate-licenses /tmp/zed_licenses_output
127
128      - name: Check for new vulnerable dependencies
129        if: github.event_name == 'pull_request'
130        uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4
131        with:
132          license-check: false
133
134      - name: Run tests
135        uses: ./.github/actions/run_tests
136
137      - name: Build collab
138        run: cargo build -p collab
139
140      - name: Build other binaries and features
141        run: |
142          cargo build --workspace --bins --all-features
143          cargo check -p gpui --features "macos-blade"
144          cargo check -p workspace
145          cargo build -p remote_server
146          cargo check -p gpui --examples
147          script/check-rust-livekit-macos
148
149      # Since the macOS runners are stateful, so we need to remove the config file to prevent potential bug.
150      - name: Clean CI config file
151        if: always()
152        run: rm -rf ./../.cargo
153
154  linux_tests:
155    timeout-minutes: 60
156    name: (Linux) Run Clippy and tests
157    if: github.repository_owner == 'zed-industries'
158    runs-on:
159      - buildjet-16vcpu-ubuntu-2204
160    steps:
161      - name: Add Rust to the PATH
162        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
163
164      - name: Checkout repo
165        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
166        with:
167          clean: false
168
169      - name: Cache dependencies
170        uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
171        with:
172          save-if: ${{ github.ref == 'refs/heads/main' }}
173          cache-provider: "buildjet"
174
175      - name: Install Linux dependencies
176        run: ./script/linux
177
178      - name: Configure CI
179        run: |
180          mkdir -p ./../.cargo
181          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
182
183      - name: cargo clippy
184        run: ./script/clippy
185
186      - name: Run tests
187        uses: ./.github/actions/run_tests
188
189      - name: Build other binaries and features
190        run: |
191          cargo build -p zed
192          cargo check -p workspace
193          cargo check -p gpui --examples
194
195      # Even the Linux runner is not stateful, in theory there is no need to do this cleanup.
196      # But, to avoid potential issues in the future if we choose to use a stateful Linux runner and forget to add code
197      # to clean up the config file, I’ve included the cleanup code here as a precaution.
198      # While it’s not strictly necessary at this moment, I believe it’s better to err on the side of caution.
199      - name: Clean CI config file
200        if: always()
201        run: rm -rf ./../.cargo
202
203  build_remote_server:
204    timeout-minutes: 60
205    name: (Linux) Build Remote Server
206    if: github.repository_owner == 'zed-industries'
207    runs-on:
208      - buildjet-16vcpu-ubuntu-2204
209    steps:
210      - name: Add Rust to the PATH
211        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
212
213      - name: Checkout repo
214        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
215        with:
216          clean: false
217
218      - name: Cache dependencies
219        uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
220        with:
221          save-if: ${{ github.ref == 'refs/heads/main' }}
222          cache-provider: "buildjet"
223
224      - name: Install Clang & Mold
225        run: ./script/remote-server && ./script/install-mold 2.34.0
226
227      - name: Configure CI
228        run: |
229          mkdir -p ./../.cargo
230          cp ./.cargo/ci-config.toml ./../.cargo/config.toml
231
232      - name: Build Remote Server
233        run: cargo build -p remote_server
234
235      - name: Clean CI config file
236        if: always()
237        run: rm -rf ./../.cargo
238
239  windows_clippy:
240    timeout-minutes: 60
241    name: (Windows) Run Clippy
242    if: github.repository_owner == 'zed-industries'
243    runs-on: hosted-windows-2
244    steps:
245      # Temporarily Collect some metadata about the hardware behind our runners.
246      - name: GHA Runner Info
247        run: |
248          Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/instance/compute?api-version=2023-07-01" |
249            ConvertTo-Json -Depth 10 |
250            jq "{ vm_size: .vmSize, location: .location, os_disk_gb: (.storageProfile.osDisk.diskSizeGB | tonumber), rs_disk_gb: (.storageProfile.resourceDisk.size | tonumber / 1024) }"
251          @{
252              Cores = (Get-CimInstance Win32_Processor).NumberOfCores
253              vCPUs = (Get-CimInstance Win32_Processor).NumberOfLogicalProcessors
254              RamGb = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
255              cpuid = (Get-CimInstance Win32_Processor).Name.Trim()
256          } | ConvertTo-Json
257      # more info here:- https://github.com/rust-lang/cargo/issues/13020
258      - name: Enable longer pathnames for git
259        run: git config --system core.longpaths true
260
261      - name: Checkout repo
262        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
263        with:
264          clean: false
265
266      - name: Create Dev Drive using ReFS
267        run: ./script/setup-dev-driver.ps1
268
269      # actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
270      - name: Copy Git Repo to Dev Drive
271        run: |
272          Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
273
274      - name: Cache dependencies
275        uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
276        with:
277          save-if: ${{ github.ref == 'refs/heads/main' }}
278          workspaces: ${{ env.ZED_WORKSPACE }}
279          cache-provider: "github"
280
281      - name: Configure CI
282        run: |
283          mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
284          cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
285
286      - name: cargo clippy
287        working-directory: ${{ env.ZED_WORKSPACE }}
288        run: ./script/clippy.ps1
289
290      - name: Check dev drive space
291        working-directory: ${{ env.ZED_WORKSPACE }}
292        # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
293        run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
294
295      # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
296      - name: Clean CI config file
297        if: always()
298        run: |
299          if (Test-Path "${{ env.CARGO_HOME }}/config.toml") {
300            Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml"  -Force
301          }
302
303  # Windows CI takes twice as long as our other platforms and fast github hosted runners are expensive.
304  # But we still want to do CI, so let's only run tests on main and come back to this when we're
305  # ready to self host our Windows CI (e.g. during the push for full Windows support)
306  windows_tests:
307    timeout-minutes: 60
308    name: (Windows) Run Tests
309    if: ${{ github.repository_owner == 'zed-industries' && (github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'windows')) }}
310    runs-on: hosted-windows-2
311    steps:
312      # Temporarily Collect some metadata about the hardware behind our runners.
313      - name: GHA Runner Info
314        run: |
315          Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/instance/compute?api-version=2023-07-01" |
316            ConvertTo-Json -Depth 10 |
317            jq "{ vm_size: .vmSize, location: .location, os_disk_gb: (.storageProfile.osDisk.diskSizeGB | tonumber), rs_disk_gb: (.storageProfile.resourceDisk.size | tonumber / 1024) }"
318          @{
319              Cores = (Get-CimInstance Win32_Processor).NumberOfCores
320              vCPUs = (Get-CimInstance Win32_Processor).NumberOfLogicalProcessors
321              RamGb = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
322              cpuid = (Get-CimInstance Win32_Processor).Name.Trim()
323          } | ConvertTo-Json
324      # more info here:- https://github.com/rust-lang/cargo/issues/13020
325      - name: Enable longer pathnames for git
326        run: git config --system core.longpaths true
327
328      - name: Checkout repo
329        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
330        with:
331          clean: false
332
333      - name: Create Dev Drive using ReFS
334        run: ./script/setup-dev-driver.ps1
335
336      # actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
337      - name: Copy Git Repo to Dev Drive
338        run: |
339          Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.ZED_WORKSPACE }}" -Recurse
340
341      - name: Cache dependencies
342        uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
343        with:
344          save-if: ${{ github.ref == 'refs/heads/main' }}
345          workspaces: ${{ env.ZED_WORKSPACE }}
346          cache-provider: "github"
347
348      - name: Configure CI
349        run: |
350          mkdir -p ${{ env.CARGO_HOME }} -ErrorAction Ignore
351          cp ./.cargo/ci-config.toml ${{ env.CARGO_HOME }}/config.toml
352
353      - name: Run tests
354        uses: ./.github/actions/run_tests_windows
355        with:
356          working-directory: ${{ env.ZED_WORKSPACE }}
357
358      - name: Build Zed
359        working-directory: ${{ env.ZED_WORKSPACE }}
360        run: cargo build
361
362      - name: Check dev drive space
363        working-directory: ${{ env.ZED_WORKSPACE }}
364        # `setup-dev-driver.ps1` creates a 100GB drive, with CI taking up ~45GB of the drive.
365        run: ./script/exit-ci-if-dev-drive-is-full.ps1 95
366
367      # Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
368      - name: Clean CI config file
369        if: always()
370        run: |
371          if (Test-Path "${{ env.CARGO_HOME }}/config.toml") {
372            Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml"  -Force
373          }
374
375  bundle-mac:
376    timeout-minutes: 120
377    name: Create a macOS bundle
378    runs-on:
379      - self-hosted
380      - bundle
381    if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
382    needs: [macos_tests]
383    env:
384      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
385      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
386      APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
387      APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
388      APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
389      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
390      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
391      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
392      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
393    steps:
394      - name: Install Node
395        uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
396        with:
397          node-version: "18"
398
399      - name: Checkout repo
400        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
401        with:
402          # We need to fetch more than one commit so that `script/draft-release-notes`
403          # is able to diff between the current and previous tag.
404          #
405          # 25 was chosen arbitrarily.
406          fetch-depth: 25
407          clean: false
408          ref: ${{ github.ref }}
409
410      - name: Limit target directory size
411        run: script/clear-target-dir-if-larger-than 100
412
413      - name: Determine version and release channel
414        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
415        run: |
416          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
417          script/determine-release-channel
418
419      - name: Draft release notes
420        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
421        run: |
422          mkdir -p target/
423          # Ignore any errors that occur while drafting release notes to not fail the build.
424          script/draft-release-notes "$RELEASE_VERSION" "$RELEASE_CHANNEL" > target/release-notes.md || true
425          script/create-draft-release target/release-notes.md
426        env:
427          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
428
429      - name: Create macOS app bundle
430        run: script/bundle-mac
431
432      - name: Rename binaries
433        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
434        run: |
435          mv target/aarch64-apple-darwin/release/Zed.dmg target/aarch64-apple-darwin/release/Zed-aarch64.dmg
436          mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
437
438      - name: Upload app bundle (aarch64) to workflow run if main branch or specific label
439        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
440        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
441        with:
442          name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
443          path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg
444
445      - name: Upload app bundle (x86_64) to workflow run if main branch or specific label
446        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
447        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
448        with:
449          name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
450          path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg
451
452      - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
453        name: Upload app bundle to release
454        if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
455        with:
456          draft: true
457          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
458          files: |
459            target/zed-remote-server-macos-x86_64.gz
460            target/zed-remote-server-macos-aarch64.gz
461            target/aarch64-apple-darwin/release/Zed-aarch64.dmg
462            target/x86_64-apple-darwin/release/Zed-x86_64.dmg
463        env:
464          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
465
466  bundle-linux-x86_x64:
467    timeout-minutes: 60
468    name: Linux x86_x64 release bundle
469    runs-on:
470      - buildjet-16vcpu-ubuntu-2004
471    if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
472    needs: [linux_tests]
473    env:
474      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
475      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
476      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
477      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
478    steps:
479      - name: Checkout repo
480        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
481        with:
482          clean: false
483
484      - name: Install Linux dependencies
485        run: ./script/linux && ./script/install-mold 2.34.0
486
487      - name: Determine version and release channel
488        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
489        run: |
490          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
491          script/determine-release-channel
492
493      - name: Create Linux .tar.gz bundle
494        run: script/bundle-linux
495
496      - name: Upload Linux bundle to workflow run if main branch or specific label
497        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
498        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
499        with:
500          name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz
501          path: target/release/zed-*.tar.gz
502
503      - name: Upload Linux remote server to workflow run if main branch or specific label
504        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
505        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
506        with:
507          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.gz
508          path: target/zed-remote-server-linux-x86_64.gz
509
510      - name: Upload app bundle to release
511        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
512        with:
513          draft: true
514          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
515          files: |
516            target/zed-remote-server-linux-x86_64.gz
517            target/release/zed-linux-x86_64.tar.gz
518        env:
519          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
520
521  bundle-linux-aarch64: # this runs on ubuntu22.04
522    timeout-minutes: 60
523    name: Linux arm64 release bundle
524    runs-on:
525      - buildjet-16vcpu-ubuntu-2204-arm
526    if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
527    needs: [linux_tests]
528    env:
529      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
530      ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
531      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
532      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
533    steps:
534      - name: Checkout repo
535        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
536        with:
537          clean: false
538
539      - name: Install Linux dependencies
540        run: ./script/linux
541
542      - name: Determine version and release channel
543        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
544        run: |
545          # This exports RELEASE_CHANNEL into env (GITHUB_ENV)
546          script/determine-release-channel
547
548      - name: Create and upload Linux .tar.gz bundle
549        run: script/bundle-linux
550
551      - name: Upload Linux bundle to workflow run if main branch or specific label
552        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
553        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
554        with:
555          name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
556          path: target/release/zed-*.tar.gz
557
558      - name: Upload Linux remote server to workflow run if main branch or specific label
559        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
560        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
561        with:
562          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.gz
563          path: target/zed-remote-server-linux-aarch64.gz
564
565      - name: Upload app bundle to release
566        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
567        with:
568          draft: true
569          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
570          files: |
571            target/zed-remote-server-linux-aarch64.gz
572            target/release/zed-linux-aarch64.tar.gz
573        env:
574          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
575
576  auto-release-preview:
577    name: Auto release preview
578    if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre') }}
579    needs: [bundle-mac, bundle-linux-x86_x64, bundle-linux-aarch64]
580    runs-on:
581      - self-hosted
582      - bundle
583    steps:
584      - name: gh release
585        run: gh release edit $GITHUB_REF_NAME --draft=true
586        env:
587          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}