Build Zed Latest Release #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Zed Latest Release | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Runs every night at midnight UTC | |
push: | |
branches: | |
- main | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
latest_tag: ${{ steps.get_latest_tag.outputs.latest_tag }} | |
proceed: ${{ steps.compare.outputs.proceed }} | |
steps: | |
- name: Get latest Zed release tag | |
id: get_latest_tag | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
latestTag=$(gh release list -R zed-industries/zed -L 10 --json tagName,isLatest -q '.[] | select(.isLatest == true) | select(.tagName | startswith("v")) | .tagName') | |
echo "Latest Zed release tag: $latestTag" | |
echo "latest_tag=$latestTag" >> $GITHUB_OUTPUT | |
- name: Get our latest release name | |
id: get_our_release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
releases=$(gh release list -R vrichv/zed-win -L 10 --json tagName,isLatest -q '.[] | select(.isLatest == true) | select(.tagName | startswith("v")) | .tagName') | |
echo "Our latest release: $releases" | |
echo "OUR_LATEST_RELEASE=$releases" >> $GITHUB_ENV | |
- name: Compare releases | |
id: compare | |
run: | | |
if [ -z "${{ steps.get_latest_tag.outputs.latest_tag }}" ] || [ "${{ env.OUR_LATEST_RELEASE }}" = "${{ steps.get_latest_tag.outputs.latest_tag }}" ]; then | |
echo "Our latest release matches Zed's latest tag. Stopping workflow." | |
echo "proceed=false" >> $GITHUB_OUTPUT | |
else | |
echo "Proceeding with build for Zed's latest tag: ${{ steps.get_latest_tag.outputs.latest_tag }}" | |
echo "proceed=true" >> $GITHUB_OUTPUT | |
fi | |
build: | |
needs: check | |
runs-on: windows-latest | |
if: needs.check.outputs.proceed == 'true' | |
steps: | |
- name: Enable long paths in Git | |
run: | | |
git config --system core.longpaths true | |
- name: Enable long paths in Windows | |
shell: powershell | |
run: | | |
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` | |
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
- name: Checkout Zed repository | |
uses: actions/checkout@v3 | |
with: | |
repository: zed-industries/zed | |
ref: ${{ needs.check.outputs.latest_tag }} | |
fetch-depth: 1 | |
- name: Set up for build | |
run: | | |
echo "Ready to build ${{ needs.check.outputs.latest_tag }}" | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
target: wasm32-wasi | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.7.3 | |
- name: Build release | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: Archive build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zed-release | |
path: target/release/zed.exe | |
release: | |
needs: [check, build] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
if: needs.check.outputs.proceed == 'true' | |
steps: | |
- name: Download release artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: zed-release | |
path: zed-release | |
- name: Zip the release artifact | |
run: zip -r zed-windows.zip zed-release/* | |
- name: Upload release build artifact to GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ needs.check.outputs.latest_tag }} | |
tag_name: ${{ needs.check.outputs.latest_tag }} | |
draft: false | |
make_latest: true | |
files: zed-windows.zip |