Build and Release Zed for Windows (Stable) #3
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 and Release Zed for Windows (Stable) | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/stable.yml" | |
schedule: | |
- cron: "0 */3 * * *" | |
workflow_dispatch: | |
inputs: | |
manual_release: | |
description: "Manual release?" | |
required: true | |
type: boolean | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
latest_release: ${{ steps.latest_release.outputs.tag }} | |
new_release: ${{ steps.check_release.outputs.new_release }} | |
steps: | |
- name: Get latest release tag from Zed | |
id: latest_release | |
run: | | |
latest_release=$(curl -s "https://api.github.com/repos/zed-industries/zed/releases/latest" | jq -r .tag_name) | |
echo "tag=$latest_release" >> $GITHUB_OUTPUT | |
- name: Check if there is a new release | |
id: check_release | |
run: | | |
my_release=$(curl -s "https://api.github.com/repos/xarunoba/zed-windows/releases/latest" | jq -r .tag_name) | |
if [ "$my_release" != "${{ steps.latest_release.outputs.tag }}" ]; then | |
echo "new_release=true" >> $GITHUB_OUTPUT | |
else | |
echo "new_release=false" >> $GITHUB_OUTPUT | |
fi | |
build: | |
runs-on: windows-latest | |
needs: check | |
if: needs.check.outputs.new_release == 'true' || github.event.inputs.manual_release == 'true' | |
strategy: | |
matrix: | |
build_type: [vulkan, opengl] | |
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 | |
uses: actions/checkout@v4 | |
with: | |
repository: zed-industries/zed | |
ref: ${{ needs.check.outputs.latest_release }} | |
- name: Install Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Build to ${{ matrix.build_type }} | |
shell: powershell | |
run: | | |
$env:RUSTFLAGS="--cfg ${{ matrix.build_type }}" | |
cargo build --release | |
- name: Archive ${{ matrix.build_type }} build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zed-${{ matrix.build_type }} | |
path: target/release/zed.exe | |
release: | |
needs: [check, build] | |
if: needs.check.outputs.new_release == 'true' || github.event.inputs.manual_release == 'true' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Download Vulkan release artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: zed-vulkan | |
path: zed-vulkan | |
- name: Download OpenGL ES release artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: zed-opengl | |
path: zed-opengl | |
- name: Zip the Vulkan build | |
working-directory: zed-vulkan | |
run: zip ../zed-vulkan-${{ needs.check.outputs.latest_release }}.zip zed.exe | |
- name: Zip the OpenGL ES build | |
working-directory: zed-opengl | |
run: zip ../zed-opengl-${{ needs.check.outputs.latest_release }}.zip zed.exe | |
- name: Generate Changelog | |
run: echo "See [Zed release note](https://github.com/zed-industries/zed/releases/tag/${{ needs.check.outputs.latest_release }}) for more information." >> CHANGELOG.txt | |
- name: Upload release build artifact to GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Zed for Windows ${{ needs.check.outputs.latest_release }} | |
body_path: CHANGELOG.txt | |
tag_name: ${{ needs.check.outputs.latest_release }} | |
draft: false | |
make_latest: true | |
files: | | |
zed-vulkan-${{ needs.check.outputs.latest_release }}.zip | |
zed-opengl-${{ needs.check.outputs.latest_release }}.zip |