-
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (96 loc) · 3.48 KB
/
release.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
name: Build and Release
permissions:
contents: write
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
targets: x86_64-pc-windows-msvc,x86_64-unknown-linux-musl
- name: Cache Cargo Registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo Build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Install NSIS
if: startsWith(matrix.os, 'windows')
run: choco install nsis --version 3.10 -y
- name: Install musl-gcc
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install musl-tools -y
- name: Build
run: cargo prepare-release
- name: Package Windows artifacts
if: startsWith(matrix.os, 'windows')
run: |
mkdir -p artifacts/windows
cp "target/release/moonlight installer.exe" "artifacts/windows/moonlight-installer.exe"
- name: Package Linux artifacts
if: startsWith(matrix.os, 'ubuntu')
run: |
mkdir -p artifacts/linux
cp target/release/moonlight-stable artifacts/linux/
cp target/release/moonlight-ptb artifacts/linux/
cp target/release/moonlight-canary artifacts/linux/
cp target/release/libmoonlight_launcher.so artifacts/linux/
cp installers/linux-sh/install.sh artifacts/linux/
mkdir -p artifacts/linux/icons
cp installers/assets/icon-*.png artifacts/linux/icons/
- name: Bundle Linux artifacts
if: startsWith(matrix.os, 'ubuntu')
run: |
cd artifacts/linux
tar -czf moonlight-stable-${{ github.ref_name }}.tar.gz moonlight-stable libmoonlight_launcher.so icons
tar -czf moonlight-ptb-${{ github.ref_name }}.tar.gz moonlight-ptb libmoonlight_launcher.so icons
tar -czf moonlight-canary-${{ github.ref_name }}.tar.gz moonlight-canary libmoonlight_launcher.so icons
rm -r moonlight-stable moonlight-ptb moonlight-canary libmoonlight_launcher.so icons
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-artifacts
path: artifacts/
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Debugging
run: ls -R
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: false
preserve_order: true
files: |
artifacts/**/windows/*
artifacts/**/linux/*