-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (132 loc) · 5.43 KB
/
stable.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
131
132
133
134
135
136
137
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 }}
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' || github.event_name == 'push'
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: Get toolchain channel
id: toolchain
shell: powershell
run: |
$channel = (Get-Content rust-toolchain.toml | Select-String -Pattern 'channel' | ForEach-Object { ($_ -split '"')[1] })
echo "channel=$channel" >> $GITHUB_OUTPUT
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ matrix.build_type }}
toolchain: ${{ steps.toolchain.outputs.channel }}
target: "wasm32-wasip1"
components: "rustfmt, clippy"
- name: Set release channel to nightly
run: |
echo "stable" > crates/zed/RELEASE_CHANNEL
- name: Build to ${{ matrix.build_type }}
shell: powershell
run: |
$env:RUSTFLAGS="--cfg ${{ matrix.build_type }}"
$env:ZED_UPDATE_EXPLANATION="Auto-updater is disabled for this build (xarunoba/zed-windows)"
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' || github.event_name == 'push'
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: Calculate SHA256 checksum
run: |
sha256sum zed-vulkan-${{ needs.check.outputs.latest_release }}.zip > zed-vulkan-${{ needs.check.outputs.latest_release }}.zip.sha256
sha256sum zed-opengl-${{ needs.check.outputs.latest_release }}.zip > zed-opengl-${{ needs.check.outputs.latest_release }}.zip.sha256
- name: Generate Release Notes from Zed
run: curl -s https://api.github.com/repos/zed-industries/zed/releases/tags/${{ needs.check.outputs.latest_release }} | jq -r .body > CHANGELOG.txt
- name: Generate Release Footer
run: echo -e "\n---\nSee [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
fail_on_unmatched_files: true
files: |
zed-vulkan-${{ needs.check.outputs.latest_release }}.zip
zed-vulkan-${{ needs.check.outputs.latest_release }}.zip.sha256
zed-opengl-${{ needs.check.outputs.latest_release }}.zip
zed-opengl-${{ needs.check.outputs.latest_release }}.zip.sha256