forked from deevus/zed-windows-builds
-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (113 loc) · 4.25 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build Zed Latest Release
on:
schedule:
- cron: "0 0 * * *" # Runs every night at midnight UTC
push:
branches:
- main
workflow_dispatch:
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
shell: powershell
run: |
Write-Output "Ready to build ${{ needs.check.outputs.latest_tag }}"
if (Test-Path ".cargo/config.toml") {
$configString = "[profile.release]`n debug = false`n lto = `"fat`"`n opt-level = 3`n codegen-units = 1`n panic = `"abort`"`n strip = true"
Write-Output "Configuration string: $configString"
$configString | Add-Content .cargo/config.toml
Write-Output "Successfully appended build parameters to .cargo/config.toml"
Get-Content .cargo/config.toml
} else {
Write-Output "Error: .cargo/config.toml file does not exist"
}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: wasm32-wasip1
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- 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