-
Notifications
You must be signed in to change notification settings - Fork 111
104 lines (90 loc) · 3.09 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
name: Rust
on:
push:
tags:
- "v*"
workflow_dispatch: # or just on button clicked
permissions:
contents: write
jobs:
build_release:
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- x86_64-pc-windows-msvc
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-musleabihf
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: armv7-unknown-linux-musleabihf
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout iptv-checker-rs
uses: actions/checkout@v4
with:
repository: zhimin-dev/iptv-checker-rs
path: iptv-checker-rs
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install Cross
if: matrix.os == 'ubuntu-latest'
working-directory: ./iptv-checker-rs
run: cargo install cross
- name: Build - windows
if: matrix.os == 'windows-latest'
working-directory: ./iptv-checker-rs
run: cargo build --release --target ${{ matrix.target }}
- name: Build - linux
if: matrix.os == 'ubuntu-latest'
working-directory: ./iptv-checker-rs
run: cross build --release --target ${{ matrix.target }}
- name: Build - macos
if: matrix.os == 'macos-latest'
working-directory: ./iptv-checker-rs
run: cargo build --release --target ${{ matrix.target }}
- name: Strip binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos'
working-directory: ./iptv-checker-rs
run: strip "target/${{ matrix.target }}/release/iptv-checker-rs"
- name: Build archive
shell: bash
working-directory: ./iptv-checker-rs
run: |
# Replace with the name of your binary
binary_name="iptv-checker-rs"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
else
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
fi
mv web $dirname
mkdir -p $dirname/static/input
mkdir -p $dirname/static/out
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./iptv-checker-rs/${{ env.ASSET }}