Zed Windows Build #24
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 | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build-windows-amd64: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: zed-industries/zed | |
- uses: dtolnay/rust-toolchain@stable | |
- run: rustup target add wasm32-wasi | |
- uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
C:\Users\runneradmin\.cargo\registry\ | |
C:\Users\runneradmin\.cargo\git\ | |
C:\Users\runneradmin\.rustup\ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- run: cargo build --release -j 4 | |
- run: copy target\release\Zed.exe target\release\Zed-windows-amd64.exe | |
- run: | | |
if [ -f target\\release\\Zed-windows-amd64.exe ]; then | |
echo "Build successful, file exists." | |
else | |
echo "Build failed, file does not exist." | |
exit 1 | |
fi | |
- name: Set version tag | |
id: set_version | |
run: | | |
LATEST_TAG=$(curl -s https://api.github.com/repos/zed-industries/zed/releases/latest | jq -r .tag_name) | |
echo "NEXT_VER_CODE=$LATEST_TAG" >> $GITHUB_ENV | |
- run: rename target\\release\\Zed-windows-amd64.exe target\\release\\Zed-windows-amd64-${{ env.NEXT_VER_CODE }}.exe | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Zed-windows-amd64 | |
path: target\\release\\zed-windows-amd64-${{ env.NEXT_VER_CODE }}.exe | |
upload-to-release: | |
runs-on: ubuntu-latest | |
needs: [build-windows-amd64] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: Zed-* | |
merge-multiple: true | |
- name: Get current date | |
id: get_date | |
run: | | |
echo "DATE=$(date +'%m-%d-%Y')" >> $GITHUB_ENV | |
- name: Fetch release body from Zed | |
id: fetch_body | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
RELEASE_DATA=$(curl -s \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
https://api.github.com/repos/zed-industries/zed/releases/latest) | |
BODY=$(echo "$RELEASE_DATA" | jq -r .body) | |
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV | |
echo "$BODY" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Set release info | |
run: | | |
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then | |
echo "RELEASE_NAME=pre${{ env.NEXT_VER_CODE }} - ${{ env.DATE }}}" >> $GITHUB_ENV | |
echo "NEXT_VER_CODE=Pre-${{ env.NEXT_VER_CODE }}" >> $GITHUB_ENV | |
else | |
echo "RELEASE_NAME=${{ env.NEXT_VER_CODE }} - ${{ env.DATE }}" >> $GITHUB_ENV | |
echo "NEXT_VER_CODE=${{ env.NEXT_VER_CODE }}" >> $GITHUB_ENV | |
fi | |
- name: Upload modules to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
release_name: ${{ env.RELEASE_NAME }} | |
tag: ${{ env.NEXT_VER_CODE }} | |
body: ${{ env.RELEASE_BODY }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/release/Zed-windows-amd64-${{ env.NEXT_VER_CODE }}.exe | |
overwrite: true | |
- uses: actions/checkout@v4 | |
with: | |
repository: yannouuuu/zed-windows-build | |
fetch-depth: 0 | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: update | |
file_pattern: build.md *-update.json | |
commit_message: Bump version ${{ env.NEXT_VER_CODE }} |