|
| 1 | +name: CEF Runtime |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + cef_version: |
| 7 | + description: "CEF version to package" |
| 8 | + required: true |
| 9 | + default: "144.0.6+g5f7e671+chromium-144.0.7559.59" |
| 10 | + source: |
| 11 | + description: "Build from official archive or CEF source" |
| 12 | + required: true |
| 13 | + type: choice |
| 14 | + default: "official" |
| 15 | + options: |
| 16 | + - official |
| 17 | + - source |
| 18 | + cef_branch: |
| 19 | + description: "Optional CEF branch for source builds" |
| 20 | + required: false |
| 21 | + default: "" |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: write |
| 25 | + |
| 26 | +jobs: |
| 27 | + build: |
| 28 | + name: Build ${{ matrix.platform }} |
| 29 | + runs-on: ${{ matrix.runner }} |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + include: |
| 34 | + - platform: macosarm64 |
| 35 | + runner: macos-14 |
| 36 | + - platform: macosx64 |
| 37 | + runner: macos-13 |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - uses: mlugg/setup-zig@v2 |
| 43 | + with: |
| 44 | + version: 0.16.0 |
| 45 | + |
| 46 | + - name: Download official CEF |
| 47 | + if: ${{ inputs.source == 'official' }} |
| 48 | + shell: bash |
| 49 | + run: | |
| 50 | + set -euo pipefail |
| 51 | + version="${{ inputs.cef_version }}" |
| 52 | + platform="${{ matrix.platform }}" |
| 53 | + archive="cef_binary_${version}_${platform}.tar.bz2" |
| 54 | + base="https://cef-builds.spotifycdn.com" |
| 55 | + mkdir -p zig-out/cef-download |
| 56 | + curl --fail --location --output "zig-out/cef-download/${archive}" "${base}/${archive}" |
| 57 | + curl --fail --location --output "zig-out/cef-download/${archive}.sha256" "${base}/${archive}.sha256" |
| 58 | + expected="$(tr -d '[:space:]' < "zig-out/cef-download/${archive}.sha256")" |
| 59 | + actual="$(shasum -a 256 "zig-out/cef-download/${archive}" | awk '{print $1}')" |
| 60 | + test "$expected" = "$actual" |
| 61 | + tar -xjf "zig-out/cef-download/${archive}" -C zig-out/cef-download |
| 62 | + echo "CEF_ROOT=zig-out/cef-download/${archive%.tar.bz2}" >> "$GITHUB_ENV" |
| 63 | +
|
| 64 | + - name: Build CEF wrapper |
| 65 | + if: ${{ inputs.source == 'official' }} |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + set -euo pipefail |
| 69 | + cmake -S "$CEF_ROOT" -B "$CEF_ROOT/build/libcef_dll_wrapper" |
| 70 | + cmake --build "$CEF_ROOT/build/libcef_dll_wrapper" --target libcef_dll_wrapper --config Release |
| 71 | + mkdir -p "$CEF_ROOT/libcef_dll_wrapper" |
| 72 | + find "$CEF_ROOT/build/libcef_dll_wrapper" -name libcef_dll_wrapper.a -print -quit | xargs -I{} cp "{}" "$CEF_ROOT/libcef_dll_wrapper/libcef_dll_wrapper.a" |
| 73 | +
|
| 74 | + - name: Prepare zero-native runtime archive |
| 75 | + if: ${{ inputs.source == 'official' }} |
| 76 | + run: | |
| 77 | + zig build |
| 78 | + zig-out/bin/zero-native cef prepare-release --dir "$CEF_ROOT" --output zig-out/cef --version "${{ inputs.cef_version }}" |
| 79 | +
|
| 80 | + - name: Build CEF from source and prepare runtime |
| 81 | + if: ${{ inputs.source == 'source' }} |
| 82 | + shell: bash |
| 83 | + run: | |
| 84 | + zig build |
| 85 | + chmod +x tools/cef/build-from-source.sh |
| 86 | + args=( |
| 87 | + tools/cef/build-from-source.sh |
| 88 | + --platform "${{ matrix.platform }}" |
| 89 | + --version "${{ inputs.cef_version }}" |
| 90 | + --output zig-out/cef |
| 91 | + --zero-native-bin zig-out/bin/zero-native |
| 92 | + ) |
| 93 | + if [ -n "${{ inputs.cef_branch }}" ]; then |
| 94 | + args+=(--cef-branch "${{ inputs.cef_branch }}") |
| 95 | + fi |
| 96 | + "${args[@]}" |
| 97 | +
|
| 98 | + - name: Publish release asset |
| 99 | + uses: softprops/action-gh-release@v2 |
| 100 | + with: |
| 101 | + tag_name: cef-${{ inputs.cef_version }} |
| 102 | + name: CEF ${{ inputs.cef_version }} |
| 103 | + files: | |
| 104 | + zig-out/cef/zero-native-cef-${{ inputs.cef_version }}-${{ matrix.platform }}.tar.gz |
| 105 | + zig-out/cef/zero-native-cef-${{ inputs.cef_version }}-${{ matrix.platform }}.tar.gz.sha256 |
0 commit comments