Skip to content

Build v0.153.4-pre

Build v0.153.4-pre #15

Workflow file for this run

name: Build
run-name: Build ${{ github.event.inputs.ref }}
on:
schedule:
- cron: '0 16 * * *'
workflow_dispatch:
inputs:
ref:
description: 'Tag to build'
required: false
default: ''
permissions:
contents: write
jobs:
checks:
name: "Run checks"
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.check_input.outputs.ref }}
build_flag: ${{ steps.version_check.outputs.build_flag }}
steps:
- name: Check input
id: check_input
run: |
if [[ -z "${{ github.event.inputs.ref }}" ]]; then
echo "No input provided, fetching latest Zed published version"
latest_zed="$(curl -sL https://api.github.com/repos/zed-industries/zed/releases | jq -r '.[0].tag_name')"
echo "ref=${latest_zed}" >> $GITHUB_OUTPUT
else
echo "ref=${{ github.event.inputs.ref }}" >> $GITHUB_OUTPUT
fi
- name: Version check
id: version_check
shell: bash
run: |
latest_zed='${{ steps.check_input.outputs.ref }}'
latest_build="$(curl -sL https://api.github.com/repos/pirafrank/zed_unofficial_win_builds/releases | jq -r '.[0].tag_name')"
if [[ "${latest_zed}" == "${latest_build}" ]]; then
echo "Update? Nope."
echo "build_flag=false" >> $GITHUB_OUTPUT
else
echo "Update? Yes!"
echo "build_flag=true" >> $GITHUB_OUTPUT
fi
build:
name: "Build Zed"
runs-on: windows-latest
needs: [checks]
if: ${{ needs.checks.outputs.build_flag == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: own
- name: Checkout Zed
shell: pwsh
run: |
git clone https://github.com/zed-industries/zed.git zed
cd zed
git checkout ${{ needs.checks.outputs.ref }}
- name: Extract toolchain channel
id: extract_toolchain
working-directory: ./zed
shell: bash
run: |
TOOLCHAIN_CHANNEL=$(grep 'channel' rust-toolchain.toml | cut -d '"' -f 2)
echo "Toolchain channel: $TOOLCHAIN_CHANNEL"
echo "TOOLCHAIN_CHANNEL=$TOOLCHAIN_CHANNEL" >> $GITHUB_OUTPUT
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.extract_toolchain.outputs.TOOLCHAIN_CHANNEL }}
target: "wasm32-wasip1"
components: "rustfmt, clippy"
- name: Show Rust toolchain info
run: |
rustc --version
rustup show
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Install Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22000
- name: Build project
working-directory: ./zed
shell: pwsh
# zed may be set to run the exe after the build, this
# won't work in an headless environment. The build at this
# point is likely to have completed successfully.
continue-on-error: true
run: |
cargo run --release
- name: Show build artifacts
working-directory: ./zed
shell: bash
run: |
ls -la target/release
- name: Check build artifacts
working-directory: ./zed
shell: bash
run: |
if [ ! -f ./target/release/zed.exe ]; then
echo "zed.exe not found. Build likely to have failed."
exit 1
fi
- name: Calculate SHA256 checksum
working-directory: ./zed/target/release
shell: bash
run: |
sha256sum zed.exe > zed.exe.sha256
- name: Create URL for release notes
id: rel_notes
shell: bash
run: |
# version in URL has no 'v' prefix, stripping
version="${{ needs.checks.outputs.ref }}"
if [[ "${version}" == v* ]]; then
version="${version:1}"
fi
echo "Version for release notes: ${{ needs.checks.outputs.ref }}"
echo "version=${{ needs.checks.outputs.ref }}" >> $GITHUB_OUTPUT
# if version contains a hyphen, it is a pre-release
# pre-release versions have their own URL path on zed.dev
if [[ "${version}" == *-* ]]; then
# remove the hyphen and anything after it
version="${version%%-*}"
url="https://zed.dev/releases/preview/${version}"
else
url="https://zed.dev/releases/stable/${version}"
fi
echo "Relese Notes URL: ${url}"
echo url=${url}>> $GITHUB_OUTPUT
- name: Create release and upload assets
uses: softprops/action-gh-release@v2
with:
files: |
./zed/target/release/zed.exe
./zed/target/release/zed.exe.sha256
name: ${{ needs.checks.outputs.ref }}
tag_name: ${{ needs.checks.outputs.ref }}
body: |
Release notes for `${{ needs.checks.outputs.ref }}` are available here: ${{ steps.rel_notes.outputs.url }}
generate_release_notes: false
draft: false
prerelease: ${{ contains(needs.checks.outputs.ref, 'pre') || contains(needs.checks.outputs.ref, '-') }}
# Note: drafts and prereleases cannot be set as latest.
make_latest: true
fail_on_unmatched_files: true
# no need to specify GITHUB_TOKEN here, it is automatically provided by GitHub Actions
# https://github.com/softprops/action-gh-release#-customizing
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication