-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (141 loc) · 5.19 KB
/
release-lsp.yml
File metadata and controls
159 lines (141 loc) · 5.19 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Release LSP
on:
workflow_dispatch:
workflow_run:
workflows: ["Release"]
types:
- completed
jobs:
get-tag:
name: Get Release Tag
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
steps:
- name: Get tag from latest release
id: get-tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=$(gh api repos/${{ github.repository }}/releases/latest --jq '.tag_name')
echo "tag=$TAG" >> $GITHUB_OUTPUT
release:
name: Release LSP - ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: get-tag
strategy:
matrix:
include:
- os: linux
arch: x64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_name: ci
asset_name: ci-lsp-linux-x64
- os: linux
arch: arm64
runner: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary_name: ci
asset_name: ci-lsp-linux-arm64
- os: windows
arch: x64
runner: windows-latest
target: x86_64-pc-windows-msvc
binary_name: ci.exe
asset_name: ci-lsp-windows-x64.exe
- os: windows
arch: arm64
runner: windows-latest
target: aarch64-pc-windows-msvc
binary_name: ci.exe
asset_name: ci-lsp-windows-arm64.exe
- os: darwin
arch: x64
runner: macos-latest
target: x86_64-apple-darwin
binary_name: ci
asset_name: ci-lsp-darwin-x64
- os: darwin
arch: arm64
runner: macos-latest
target: aarch64-apple-darwin
binary_name: ci
asset_name: ci-lsp-darwin-arm64
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: ${{ needs.get-tag.outputs.tag }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Configure cross-compilation (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
echo "[target.aarch64-unknown-linux-gnu]" >> ~/.cargo/config.toml
echo "linker = \"aarch64-linux-gnu-gcc\"" >> ~/.cargo/config.toml
- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-lsp-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-lsp-
- name: Build release binary with LSP feature
run: cargo build --release --features lsp --target ${{ matrix.target }}
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: target/${{ matrix.target }}/release/${{ matrix.binary_name }}
upload-lsp-binaries:
name: Upload LSP Binaries
runs-on: ubuntu-latest
needs: [get-tag, release]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload Linux x64 binary
run: |
cp artifacts/ci-lsp-linux-x64/ci ci-lsp-linux-x64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-linux-x64 --repo ${{ github.repository }}
- name: Upload Linux arm64 binary
run: |
cp artifacts/ci-lsp-linux-arm64/ci ci-lsp-linux-arm64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-linux-arm64 --repo ${{ github.repository }}
- name: Upload Windows x64 binary
run: |
cp artifacts/ci-lsp-windows-x64.exe/ci.exe ci-lsp-windows-x64.exe
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-windows-x64.exe --repo ${{ github.repository }}
- name: Upload Windows arm64 binary
run: |
cp artifacts/ci-lsp-windows-arm64.exe/ci.exe ci-lsp-windows-arm64.exe
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-windows-arm64.exe --repo ${{ github.repository }}
- name: Upload macOS x64 binary
run: |
cp artifacts/ci-lsp-darwin-x64/ci ci-lsp-darwin-x64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-darwin-x64 --repo ${{ github.repository }}
- name: Upload macOS arm64 binary
run: |
cp artifacts/ci-lsp-darwin-arm64/ci ci-lsp-darwin-arm64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-darwin-arm64 --repo ${{ github.repository }}
- name: Purge artifacts
uses: omarabid-forks/purge-artifacts@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 0