-
Notifications
You must be signed in to change notification settings - Fork 3
executable file
·102 lines (87 loc) · 4.13 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
102
name: Build miasst
on:
push:
paths:
- miasst.c
pull_request:
paths:
- miasst.c
workflow_dispatch:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Tag & Release
run: |
VERSION=$(grep -oP '#define VERSION "\K[^"]+' miasst.c)
if ! git ls-remote --tags origin | grep -q "$VERSION"; then
git tag "$VERSION"
git push origin "$VERSION"
else
echo "Tag $VERSION already exists, skipping tag creation."
fi
if ! gh release view $VERSION; then
gh release create $VERSION --title "Release $VERSION"
else
echo "Release $VERSION already exists, skipping release creation."
fi
- name: Install Dependencies
run: |
docker run --privileged aptman/qus -s -- -p aarch64 arm
sudo apt-get install -y mingw-w64 libusb-1.0-0-dev libssl-dev libcurl4-openssl-dev
git clone https://github.com/rafagafe/tiny-json.git
curl -L -o openssl.zip https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-3.4.0.zip && 7z x openssl.zip -o./openssl && rm openssl.zip
curl -L -o libusb.7z https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z && 7z x libusb.7z -o./libusb && rm libusb.7z
curl -L -o curl32.zip https://curl.se/windows/dl-8.11.0_1/curl-8.11.0_1-win32-mingw.zip && 7z x curl32.zip -o./curl && rm curl32.zip && mv curl/curl-8.11.0_1-win32-mingw curl/win32
curl -L -o curl64.zip https://curl.se/windows/dl-8.11.0_1/curl-8.11.0_1-win64-mingw.zip && 7z x curl64.zip -o./curl && rm curl64.zip && mv curl/curl-8.11.0_1-win64-mingw curl/win64
- name: Build for Windows
run: |
for arch in i686 x86_64; do
suffix=""
if [ "$arch" == "i686" ]; then
suffix="32"
op="x86"
elif [ "$arch" == "x86_64" ]; then
suffix="64"
op="x64"
fi
$arch-w64-mingw32-gcc -o miasst_windows${suffix}.exe miasst.c tiny-json/tiny-json.c \
-I./libusb/include -I./openssl/${op}/include -I./curl/win${suffix}/include -I./tiny-json \
-L./libusb/MinGW${suffix}/static -L./openssl/${op}/lib -L./curl/win${suffix}/lib \
-lusb-1.0 -lssl -lcrypto -lcurl
done
- name: Build miasst for Termux
run: |
for arch in arm aarch64; do
docker run --name $arch --privileged \
-v $(pwd)/miasst.c:/data/data/com.termux/files/home/miasst.c \
-v $(pwd)/tiny-json:/data/data/com.termux/files/home/tiny-json \
termux/termux-docker:$arch bash -c "yes | pkg install clang && yes | pkg install libusb && yes | pkg install libc++ && clang -o miasst_termux_$arch miasst.c tiny-json/tiny-json.c -I/usr/include/openssl -I. -lssl -lcrypto -lcurl -lusb-1.0"
docker cp $arch:/data/data/com.termux/files/home/miasst_termux_$arch ./
done
- name: Build for Ubuntu
run: |
gcc -o miasst_ubuntu miasst.c tiny-json/tiny-json.c \
-I/usr/include/openssl -I. -lssl -lcrypto -lcurl -lusb-1.0
- name: Upload
run: |
VERSION=$(grep -oP '#define VERSION "\K[^"]+' miasst.c)
gh release upload $VERSION ./miasst_windows32.exe ./miasst_windows64.exe ./miasst_ubuntu ./miasst_termux_aarch64 ./miasst_termux_arm --clobber
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: |
brew install libusb openssl curl
git clone https://github.com/rafagafe/tiny-json.git
- name: Build miasst for macOS
run: |
clang -o miasst_macos miasst.c tiny-json/tiny-json.c -I/System/Volumes/Data/opt/homebrew/Cellar/libusb/1.0.27/include -I/System/Volumes/Data/opt/homebrew/opt/openssl/include -L/System/Volumes/Data/opt/homebrew/Cellar/libusb/1.0.27/lib -L/System/Volumes/Data/opt/homebrew/opt/openssl/lib -I. -lssl -lcrypto -lcurl -lusb-1.0
- name: Upload macOS Build
run: |
VERSION=$(awk -F'"' '/#define VERSION/ {print $2}' miasst.c)
gh release upload $VERSION ./miasst_macos --clobber