-
Notifications
You must be signed in to change notification settings - Fork 22
101 lines (85 loc) · 2.76 KB
/
build.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
name: Build
on:
workflow_dispatch:
push:
tags:
- "*"
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C strip=symbols"
jobs:
build:
name: Build for ${{ matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: mpv-handler
asset_name: linux-amd64
target: x86_64-unknown-linux-musl
- os: windows-latest
artifact_name: mpv-handler.exe
artifact_name_debug: mpv-handler-debug.exe
asset_name: windows-amd64
asset_name_debug: windows-amd64-debug
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get install -y musl
rustup target add x86_64-unknown-linux-musl
- name: Build
run: |
cargo build --release --locked --target ${{ matrix.target }}
- name: Upload to artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
- name: Build mpv-debug for Windows
if: matrix.os == 'windows-latest'
run: |
cargo build --release --locked --target ${{ matrix.target }} `
--features console
move target/${{ matrix.target }}/release/${{ matrix.artifact_name }} `
target/${{ matrix.target }}/release/${{ matrix.artifact_name_debug }}
- name: Upload mpv-debug to artifact
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name_debug }}
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name_debug }}
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Package Linux
run: |
zip -j mpv-handler-linux-amd64.zip \
README*.md \
share/linux/* \
linux-amd64/mpv-handler
- name: Package Windows
run: |
zip -j mpv-handler-windows-amd64.zip \
README*.md \
share/windows/* \
windows-amd64/mpv-handler.exe \
windows-amd64-debug/mpv-handler-debug.exe
- name: SHA512SUM
run: |
sha512sum mpv-handler-*.zip > sha512sum
- name: Publish
uses: ncipollo/release-action@v1
with:
artifacts: "mpv-handler-*.zip,sha512sum"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}