|
5 | 5 | workflow_dispatch: |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - java-cef-linux: |
9 | | - runs-on: [ubuntu-20.04] |
10 | | - strategy: |
11 | | - matrix: |
12 | | - platform: [amd64, arm64] |
13 | | - steps: |
14 | | - - uses: actions/checkout@v4 |
15 | | - - name: Install deps and build |
16 | | - run: | |
17 | | - sudo apt update |
18 | | - sudo apt install build-essential g++ cmake ninja-build openjdk-17-jdk python3 libgtk2.0-dev -y |
19 | | - mkdir jcef_build && cd jcef_build |
20 | | - cmake -G "Ninja" -DPROJECT_ARCH=${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release .. |
21 | | - ninja -j4 |
22 | | - mv native/Release linux_${{ matrix.platform }} |
23 | | - strip linux_${{ matrix.platform }}/libcef.so |
24 | | - python3 ../.github/workflows/scripts/generate_hash.py linux_${{ matrix.platform }} |
25 | | - mv linux_${{ matrix.platform }}/.hash ./ |
26 | | - tar -czf linux_${{ matrix.platform }}.tar.gz linux_${{ matrix.platform }} .hash |
27 | | - sha256sum linux_${{ matrix.platform }}.tar.gz > linux_${{ matrix.platform }}.tar.gz.sha256 |
28 | | - - uses: actions/upload-artifact@v4 |
29 | | - if: ${{ github.ref == 'refs/heads/master' }} |
30 | | - with: |
31 | | - name: 'linux_${{ matrix.platform }}' |
32 | | - path: | |
33 | | - jcef_build/linux_${{ matrix.platform }}.tar.gz |
34 | | - jcef_build/linux_${{ matrix.platform }}.tar.gz.sha256 |
35 | | - if-no-files-found: error |
36 | 8 |
|
37 | 9 | java-cef-windows: |
38 | 10 | runs-on: [windows-2022] |
|
56 | 28 | tar -czf windows_${{ matrix.platform }}.tar.gz windows_${{ matrix.platform }} .hash |
57 | 29 | Get-FileHash -Algorithm SHA256 -Path "windows_${{ matrix.platform }}.tar.gz" | Out-File "windows_${{ matrix.platform }}.tar.gz.sha256" |
58 | 30 | - uses: actions/upload-artifact@v4 |
59 | | - if: ${{ github.ref == 'refs/heads/master' }} |
60 | 31 | with: |
61 | 32 | name: 'windows_${{ matrix.platform }}' |
62 | 33 | path: | |
63 | 34 | jcef_build/windows_${{ matrix.platform }}.tar.gz |
64 | 35 | jcef_build/windows_${{ matrix.platform }}.tar.gz.sha256 |
65 | 36 | if-no-files-found: error |
66 | | - |
67 | | - java-cef-macos: |
68 | | - runs-on: [macos-13] |
69 | | - strategy: |
70 | | - matrix: |
71 | | - platform: [amd64, arm64] |
72 | | - steps: |
73 | | - - uses: actions/checkout@v4 |
74 | | - - name: Set up Python 3.9 |
75 | | - uses: actions/setup-python@v4 |
76 | | - with: |
77 | | - python-version: '3.9' |
78 | | - - run: | |
79 | | - brew install ninja |
80 | | - brew install coreutils |
81 | | - sudo xcode-select -s /Applications/Xcode.app |
82 | | - mkdir jcef_build && cd jcef_build |
83 | | - cmake -G "Ninja" -DPROJECT_ARCH=${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release .. |
84 | | - ninja -j4 |
85 | | - mv native/Release macos_${{ matrix.platform }} |
86 | | - python3 ../.github/workflows/scripts/generate_hash.py macos_${{ matrix.platform }} |
87 | | - mv macos_${{ matrix.platform }}/.hash ./ |
88 | | - tar -czf macos_${{ matrix.platform }}.tar.gz macos_${{ matrix.platform }} .hash |
89 | | - sha256sum macos_${{ matrix.platform }}.tar.gz > macos_${{ matrix.platform }}.tar.gz.sha256 |
90 | | - - uses: actions/upload-artifact@v4 |
91 | | - if: ${{ github.ref == 'refs/heads/master' }} |
92 | | - with: |
93 | | - name: 'macos_${{ matrix.platform }}' |
94 | | - path: | |
95 | | - jcef_build/macos_${{ matrix.platform }}.tar.gz |
96 | | - jcef_build/macos_${{ matrix.platform }}.tar.gz.sha256 |
97 | | - if-no-files-found: error |
98 | | - check-secret: |
99 | | - runs-on: ubuntu-20.04 |
100 | | - if: github.ref == 'refs/heads/master' |
101 | | - steps: |
102 | | - - name: Check secret |
103 | | - env: |
104 | | - API_TOKEN: ${{ secrets.API_TOKEN }} |
105 | | - run: | |
106 | | - if [ -z "$API_TOKEN" ]; then |
107 | | - echo "API_TOKEN is not set. Upload will not proceed." |
108 | | - exit 1 |
109 | | - fi |
110 | | - echo "API_TOKEN is set. Upload can proceed." |
111 | | -
|
112 | | - upload-to-api: |
113 | | - needs: [java-cef-linux, java-cef-windows, java-cef-macos, check-secret] |
114 | | - runs-on: ubuntu-20.04 |
115 | | - if: github.ref == 'refs/heads/master' |
116 | | - strategy: |
117 | | - matrix: |
118 | | - platform: [linux_amd64, linux_arm64, windows_amd64, windows_arm64, macos_amd64, macos_arm64] |
119 | | - steps: |
120 | | - - name: Download artifact |
121 | | - uses: actions/download-artifact@v4 |
122 | | - with: |
123 | | - name: ${{ matrix.platform }} |
124 | | - - name: Upload to LiquidBounce API |
125 | | - env: |
126 | | - API_TOKEN: ${{ secrets.API_TOKEN }} |
127 | | - run: | |
128 | | - PLATFORM="${{ matrix.platform }}" |
129 | | - |
130 | | - response=$(curl -w "\n%{http_code}" -X POST \ |
131 | | - -H "Authorization: Bearer $API_TOKEN" \ |
132 | | - -H "Content-Type: application/gzip" \ |
133 | | - --data-binary "@${PLATFORM}.tar.gz" \ |
134 | | - "http://nossl.api.liquidbounce.net/api/v3/resource/mcef-cef/${{ github.sha }}/${PLATFORM}") |
135 | | - |
136 | | - status_code=$(echo "$response" | tail -n1) |
137 | | - response_body=$(echo "$response" | sed '$d') |
138 | | - |
139 | | - echo "Status code: $status_code" |
140 | | - echo "Response body: $response_body" |
141 | | - |
142 | | - if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then |
143 | | - echo "Upload failed with status code $status_code" |
144 | | - exit 1 |
145 | | - fi |
0 commit comments