release_nightly.yml

  1name: Release Nightly
  2
  3on:
  4  schedule:
  5    # Fire every day at 7:00am UTC (Roughly before EU workday and after US workday)
  6    - cron: "0 7 * * *"
  7  push:
  8    tags:
  9      - "nightly"
 10
 11env:
 12  CARGO_TERM_COLOR: always
 13  CARGO_INCREMENTAL: 0
 14  RUST_BACKTRACE: 1
 15
 16jobs:
 17  style:
 18    timeout-minutes: 60
 19    name: Check formatting and Clippy lints
 20    if: github.repository_owner == 'zed-industries'
 21    runs-on:
 22      - self-hosted
 23      - macOS
 24    steps:
 25      - name: Checkout repo
 26        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 27        with:
 28          clean: false
 29          fetch-depth: 0
 30
 31      - name: Run style checks
 32        uses: ./.github/actions/check_style
 33
 34      - name: Run clippy
 35        run: ./script/clippy
 36
 37  tests:
 38    timeout-minutes: 60
 39    name: Run tests
 40    if: github.repository_owner == 'zed-industries'
 41    runs-on:
 42      - self-hosted
 43      - macOS
 44    needs: style
 45    steps:
 46      - name: Checkout repo
 47        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 48        with:
 49          clean: false
 50
 51      - name: Run tests
 52        uses: ./.github/actions/run_tests
 53
 54  bundle-mac:
 55    timeout-minutes: 60
 56    name: Create a macOS bundle
 57    if: github.repository_owner == 'zed-industries'
 58    runs-on:
 59      - self-hosted
 60      - bundle
 61    needs: tests
 62    env:
 63      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
 64      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
 65      APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }}
 66      APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
 67      APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
 68      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
 69      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
 70      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
 71    steps:
 72      - name: Install Node
 73        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
 74        with:
 75          node-version: "18"
 76
 77      - name: Checkout repo
 78        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
 79        with:
 80          clean: false
 81
 82      - name: Set release channel to nightly
 83        run: |
 84          set -eu
 85          version=$(git rev-parse --short HEAD)
 86          echo "Publishing version: ${version} on release channel nightly"
 87          echo "nightly" > crates/zed/RELEASE_CHANNEL
 88
 89      - name: Create macOS app bundle
 90        run: script/bundle-mac
 91
 92      - name: Upload Zed Nightly
 93        run: script/upload-nightly macos
 94
 95  bundle-linux-x86:
 96    timeout-minutes: 60
 97    name: Create a Linux *.tar.gz bundle for x86
 98    if: github.repository_owner == 'zed-industries'
 99    runs-on:
100      - buildjet-16vcpu-ubuntu-2004
101    needs: tests
102    env:
103      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
104      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
105      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
106    steps:
107      - name: Checkout repo
108        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
109        with:
110          clean: false
111
112      - name: Add Rust to the PATH
113        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
114
115      - name: Install Linux dependencies
116        run: ./script/linux && ./script/install-mold 2.34.0
117
118      - name: Limit target directory size
119        run: script/clear-target-dir-if-larger-than 100
120
121      - name: Set release channel to nightly
122        run: |
123          set -euo pipefail
124          version=$(git rev-parse --short HEAD)
125          echo "Publishing version: ${version} on release channel nightly"
126          echo "nightly" > crates/zed/RELEASE_CHANNEL
127
128      - name: Create Linux .tar.gz bundle
129        run: script/bundle-linux
130
131      - name: Upload Zed Nightly
132        run: script/upload-nightly linux-targz
133
134  bundle-linux-arm:
135    timeout-minutes: 60
136    name: Create a Linux *.tar.gz bundle for ARM
137    if: github.repository_owner == 'zed-industries'
138    runs-on:
139      - buildjet-16vcpu-ubuntu-2204-arm
140    needs: tests
141    env:
142      DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
143      DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
144      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
145    steps:
146      - name: Checkout repo
147        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
148        with:
149          clean: false
150
151      - name: Install Linux dependencies
152        run: ./script/linux
153
154      - name: Limit target directory size
155        run: script/clear-target-dir-if-larger-than 100
156
157      - name: Set release channel to nightly
158        run: |
159          set -euo pipefail
160          version=$(git rev-parse --short HEAD)
161          echo "Publishing version: ${version} on release channel nightly"
162          echo "nightly" > crates/zed/RELEASE_CHANNEL
163
164      - name: Create Linux .tar.gz bundle
165        run: script/bundle-linux
166
167      - name: Upload Zed Nightly
168        run: script/upload-nightly linux-targz
169
170  freebsd:
171    timeout-minutes: 60
172    if: github.repository_owner == 'zed-industries'
173    runs-on: github-8vcpu-ubuntu-2404
174    needs: tests
175    name: Build Zed on FreeBSD
176    # env:
177    #   MYTOKEN : ${{ secrets.MYTOKEN }}
178    #   MYTOKEN2: "value2"
179    steps:
180      - uses: actions/checkout@v4
181      - name: Build FreeBSD remote-server
182        id: freebsd-build
183        uses: vmactions/freebsd-vm@c3ae29a132c8ef1924775414107a97cac042aad5 # v1.2.0
184        with:
185          # envs: "MYTOKEN MYTOKEN2"
186          usesh: true
187          release: 13.5
188          copyback: true
189          prepare: |
190            pkg install -y \
191              bash curl jq git \
192              rustup-init cmake-core llvm-devel-lite pkgconf protobuf # ibx11 alsa-lib rust-bindgen-cli
193          run: |
194            freebsd-version
195            sysctl hw.model
196            sysctl hw.ncpu
197            sysctl hw.physmem
198            sysctl hw.usermem
199            git config --global --add safe.directory /home/runner/work/zed/zed
200            rustup-init --profile minimal --default-toolchain none -y
201            . "$HOME/.cargo/env"
202            ./script/bundle-freebsd
203            mkdir -p out/
204            mv "target/zed-remote-server-freebsd-x86_64.gz" out/
205            rm -rf target/
206            cargo clean
207
208      - name: Upload Artifact to Workflow - zed-remote-server (run-bundling)
209        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
210        if: contains(github.event.pull_request.labels.*.name, 'run-bundling')
211        with:
212          name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-freebsd.gz
213          path: out/zed-remote-server-freebsd-x86_64.gz
214
215      - name: Upload Artifacts to release
216        uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
217        if: ${{ !(contains(github.event.pull_request.labels.*.name, 'run-bundling')) }}
218        with:
219          draft: true
220          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
221          files: |
222            out/zed-remote-server-freebsd-x86_64.gz
223        env:
224          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225
226  bundle-nix:
227    name: Build and cache Nix package
228    needs: tests
229    uses: ./.github/workflows/nix.yml
230
231  update-nightly-tag:
232    name: Update nightly tag
233    if: github.repository_owner == 'zed-industries'
234    runs-on: ubuntu-latest
235    needs:
236      - bundle-mac
237      - bundle-linux-x86
238      - bundle-linux-arm
239    steps:
240      - name: Checkout repo
241        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
242        with:
243          fetch-depth: 0
244
245      - name: Update nightly tag
246        run: |
247          if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then
248            echo "Nightly tag already points to current commit. Skipping tagging."
249            exit 0
250          fi
251          git config user.name github-actions
252          git config user.email github-actions@github.com
253          git tag -f nightly
254          git push origin nightly --force