forked from CinemaMod/java-cef
-
Notifications
You must be signed in to change notification settings - Fork 4
138 lines (129 loc) · 4.97 KB
/
build-jcef.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Build java-cef
on:
push:
workflow_dispatch:
jobs:
java-cef-linux:
runs-on: [ubuntu-20.04]
strategy:
matrix:
platform: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Install deps and build
run: |
sudo apt update
sudo apt install build-essential g++ cmake ninja-build openjdk-17-jdk python3 libgtk2.0-dev -y
mkdir jcef_build && cd jcef_build
cmake -G "Ninja" -DPROJECT_ARCH=${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release ..
ninja -j4
mv native/Release linux_${{ matrix.platform }}
strip linux_${{ matrix.platform }}/libcef.so
tar -czf linux_${{ matrix.platform }}.tar.gz linux_${{ matrix.platform }}
sha256sum linux_${{ matrix.platform }}.tar.gz > linux_${{ matrix.platform }}.tar.gz.sha256
- uses: actions/upload-artifact@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
name: 'linux_${{ matrix.platform }}'
path: |
jcef_build/linux_${{ matrix.platform }}.tar.gz
jcef_build/linux_${{ matrix.platform }}.tar.gz.sha256
if-no-files-found: error
java-cef-windows:
runs-on: [windows-2022]
strategy:
matrix:
platform: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Build
run: |
mkdir jcef_build && cd jcef_build
cmake -G "Ninja" -DPROJECT_ARCH=${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release ..
ninja -j4
cd native
ren Release windows_${{ matrix.platform }}
cd ..
move native/windows_${{ matrix.platform }} windows_${{ matrix.platform }}
tar -czf windows_${{ matrix.platform }}.tar.gz windows_${{ matrix.platform }}
Get-FileHash -Algorithm SHA256 -Path "windows_${{ matrix.platform }}.tar.gz" | Out-File "windows_${{ matrix.platform }}.tar.gz.sha256"
- uses: actions/upload-artifact@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
name: 'windows_${{ matrix.platform }}'
path: |
jcef_build/windows_${{ matrix.platform }}.tar.gz
jcef_build/windows_${{ matrix.platform }}.tar.gz.sha256
if-no-files-found: error
java-cef-macos:
runs-on: [macos-13]
strategy:
matrix:
platform: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- run: |
brew install ninja
brew install coreutils
sudo xcode-select -s /Applications/Xcode.app
mkdir jcef_build && cd jcef_build
cmake -G "Ninja" -DPROJECT_ARCH=${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release ..
ninja -j4
mv native/Release macos_${{ matrix.platform }}
tar -czf macos_${{ matrix.platform }}.tar.gz macos_${{ matrix.platform }}
sha256sum macos_${{ matrix.platform }}.tar.gz > macos_${{ matrix.platform }}.tar.gz.sha256
- uses: actions/upload-artifact@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
name: 'macos_${{ matrix.platform }}'
path: |
jcef_build/macos_${{ matrix.platform }}.tar.gz
jcef_build/macos_${{ matrix.platform }}.tar.gz.sha256
if-no-files-found: error
check-secret:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master'
steps:
- name: Check secret
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
run: |
if [ -z "$API_TOKEN" ]; then
echo "API_TOKEN is not set. Upload will not proceed."
exit 1
fi
echo "API_TOKEN is set. Upload can proceed."
upload-to-api:
needs: [java-cef-linux, java-cef-windows, java-cef-macos, check-secret]
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master'
strategy:
matrix:
platform: [linux_amd64, linux_arm64, windows_amd64, windows_arm64, macos_amd64, macos_arm64]
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.platform }}
- name: Upload to LiquidBounce API
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
run: |
PLATFORM="${{ matrix.platform }}"
response=$(curl -w "\n%{http_code}" -X POST \
-H "Authorization: Bearer $API_TOKEN" \
-F "file=@${PLATFORM}.tar.gz" \
"http://nossl.api.liquidbounce.net/api/v3/resource/mcef-cef/${{ github.sha }}/${PLATFORM}")
status_code=$(echo "$response" | tail -n1)
response_body=$(echo "$response" | sed '$d')
echo "Status code: $status_code"
echo "Response body: $response_body"
if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then
echo "Upload failed with status code $status_code"
exit 1
fi