-
Notifications
You must be signed in to change notification settings - Fork 7
87 lines (79 loc) · 3.33 KB
/
publish-exe.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
on:
push:
tags:
- "v*.*.*"
name: Publish Releases
jobs:
build_publish:
name: Publishing Tasks
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- i686-unknown-linux-musl
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
include:
- target: x86_64-unknown-linux-gnu
host_os: ubuntu-latest
- target: x86_64-unknown-linux-musl
host_os: ubuntu-latest
- target: i686-unknown-linux-musl
host_os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
host_os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
host_os: ubuntu-latest
- target: x86_64-apple-darwin
host_os: macos-latest
- target: aarch64-apple-darwin
host_os: macos-latest
- target: x86_64-pc-windows-msvc
host_os: windows-latest
- target: i686-pc-windows-msvc
host_os: windows-latest
runs-on: ${{ matrix.host_os }}
steps:
- uses: actions/checkout@v3
- name: Prepare
shell: bash
run: |
mkdir mypubdir4
rustup target add ${{ matrix.target }}
if [[ "${{ matrix.host_os }}" == "ubuntu-latest" ]]; then
sudo .github/workflows/install-cross.sh
fi
- name: Build
shell: bash
run: |
if [[ "${{ matrix.host_os }}" == "ubuntu-latest" ]]; then
cross build --all-features --release --target ${{ matrix.target }}
else
cargo build --all-features --release --target ${{ matrix.target }}
fi
cbindgen --config cbindgen.toml -l C -o target/dns2socks-ffi.h
if [[ "${{ matrix.host_os }}" == "windows-latest" ]]; then
powershell -Command "(Get-Item README.md).LastWriteTime = Get-Date"
powershell Compress-Archive -Path target/${{ matrix.target }}/release/dns2socks.exe, README.md, target/dns2socks-ffi.h, target/${{ matrix.target }}/release/dns2socks.dll -DestinationPath mypubdir4/dns2socks-${{ matrix.target }}.zip
elif [[ "${{ matrix.host_os }}" == "macos-latest" ]]; then
zip -j mypubdir4/dns2socks-${{ matrix.target }}.zip target/${{ matrix.target }}/release/dns2socks README.md target/dns2socks-ffi.h target/${{ matrix.target }}/release/libdns2socks.dylib
if [[ "${{ matrix.target }}" == "x86_64-apple-darwin" ]]; then
./build-aarch64-apple-ios.sh
zip -r mypubdir4/dns2socks-aarch64-apple-ios-xcframework.zip ./dns2socks.xcframework/
./build-apple.sh
zip -r mypubdir4/dns2socks-apple-xcframework.zip ./dns2socks.xcframework/
fi
elif [[ "${{ matrix.host_os }}" == "ubuntu-latest" ]]; then
zip -j mypubdir4/dns2socks-${{ matrix.target }}.zip target/${{ matrix.target }}/release/dns2socks README.md target/dns2socks-ffi.h target/${{ matrix.target }}/release/libdns2socks.so
fi
- name: Publish
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: mypubdir4/*