-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.02 KB
/
release.yml
File metadata and controls
75 lines (64 loc) · 2.02 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
name: Rust Release
on:
release:
types: [created] # Trigger when a new GitHub release is created
jobs:
build:
name: Build Rust Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: basecode-lsp-linux
- os: macos-latest
target: x86_64-apple-darwin
artifact: basecode-lsp-macos
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: basecode-lsp-windows.exe
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build Release Binary
run: cargo build --release --target ${{ matrix.target }}
- name: Rename Binary
run: |
mkdir artifacts
if [ "${{ runner.os }}" == "Windows" ]; then
mv target/${{ matrix.target }}/release/basecode-lsp.exe artifacts/${{ matrix.artifact }}
else
mv target/${{ matrix.target }}/release/basecode-lsp artifacts/${{ matrix.artifact }}
fi
shell: bash
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: artifacts/${{ matrix.artifact }}
release:
name: Upload to GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download All Binaries
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display Downloaded Files
run: ls -R artifacts
- name: Upload Binaries to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}