-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (84 loc) · 3.01 KB
/
Copy pathrelease.yml
File metadata and controls
92 lines (84 loc) · 3.01 KB
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
name: Release codetime-ls
# Tag a release (e.g. `git tag v0.1.0 && git push --tags`) to build the language
# server for every platform the Zed extension downloads, and attach the
# `codetime-ls-<target-triple>.zip` assets the extension looks for.
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: false
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
- os: macos-latest
target: x86_64-apple-darwin
cross: false
- os: macos-latest
target: aarch64-apple-darwin
cross: false
- os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
# Native ARM64 runner: cross-compiling the TLS backend from x64
# Windows is brittle, so build aarch64-windows on real hardware.
- os: windows-11-arm
target: aarch64-pc-windows-msvc
cross: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
run: cargo install cross --locked
- name: Build
shell: bash
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --manifest-path codetime-ls/Cargo.toml --release --target ${{ matrix.target }}
else
cargo build --manifest-path codetime-ls/Cargo.toml --release --target ${{ matrix.target }}
fi
- name: Package
shell: bash
run: |
bin=codetime-ls
ext=""
if [[ "${{ matrix.target }}" == *windows* ]]; then ext=".exe"; fi
src="codetime-ls/target/${{ matrix.target }}/release/${bin}${ext}"
out="codetime-ls-${{ matrix.target }}.zip"
# Stage in a separate dir. The repo already has a `codetime-ls/`
# source dir, so copying the binary to ./codetime-ls would land it
# *inside* that dir and the archive would capture the whole source
# tree (the extension then tries to exec a directory -> EACCES).
mkdir -p dist
cp "$src" "dist/${bin}${ext}"
(
cd dist
if [[ "${{ matrix.target }}" == *windows* ]]; then
# Windows ignores the executable bit; 7z is always on the runner.
7z a "../$out" "${bin}${ext}"
else
# Unix: keep +x and use Info-ZIP `zip`, which records the mode so
# the extracted binary stays executable.
chmod +x "${bin}${ext}"
zip "../$out" "${bin}${ext}"
fi
)
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: codetime-ls-${{ matrix.target }}.zip