Version 0.0.6 #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Binary Files | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-mac: | |
| if: startsWith(github.ref, 'refs/heads/ci/prebuilt-') == false | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Initialize submodules | |
| run: | | |
| git submodule sync --recursive | |
| git submodule update --init --recursive | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Build libre (re) static and stage SDK | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ROOT="$GITHUB_WORKSPACE" | |
| cd "$ROOT/deps/re" | |
| rm -rf build | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build -j | |
| mkdir -p "$ROOT/local/re/lib" "$ROOT/local/re/include" | |
| if [[ -f build/libre.a ]]; then cp -a build/libre.a "$ROOT/local/re/lib/"; \ | |
| elif [[ -f build/lib/libre.a ]]; then cp -a build/lib/libre.a "$ROOT/local/re/lib/"; \ | |
| else echo "libre.a not found" >&2; exit 1; fi | |
| cp -a include/* "$ROOT/local/re/include/" | |
| - name: Build baresip static and stage SDK | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ROOT="$GITHUB_WORKSPACE" | |
| cd "$ROOT/deps/baresip" | |
| rm -rf build | |
| cmake -B build -DSTATIC=ON -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build -j | |
| mkdir -p "$ROOT/local/baresip/lib" "$ROOT/local/baresip/include" | |
| if [[ -f build/libbaresip.a ]]; then cp -a build/libbaresip.a "$ROOT/local/baresip/lib/"; \ | |
| elif [[ -f build/lib/libbaresip.a ]]; then cp -a build/lib/libbaresip.a "$ROOT/local/baresip/lib/"; \ | |
| else echo "libbaresip.a not found" >&2; exit 1; fi | |
| cp -a include/* "$ROOT/local/baresip/include/" | |
| - name: Build Node addon (cmake-js) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| rm -rf build | |
| npx cmake-js rebuild | |
| - name: Stage prebuilt binary | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| PLATFORM=$(node -p "process.platform") | |
| ARCH=$(node -p "process.arch") | |
| ABI="node-v$(node -p 'process.versions.modules')" | |
| OUTDIR="prebuilt/${PLATFORM}-${ARCH}/${ABI}" | |
| mkdir -p "$OUTDIR" | |
| cp -a build/Release/baresip_node.node "$OUTDIR/" | |
| - name: Clean build artifacts (keep prebuilt) | |
| run: rm -rf build | |
| - name: Compute Node ABI | |
| id: vars | |
| shell: bash | |
| run: echo "abi=node-v$(node -p 'process.versions.modules')" >> "$GITHUB_OUTPUT" | |
| - name: Create PR with prebuilt binaries | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| commit-message: "chore: update prebuilt (darwin-arm64 ${{ steps.vars.outputs.abi }})" | |
| title: "Update prebuilt binaries (darwin-arm64, ${{ steps.vars.outputs.abi }})" | |
| body: | | |
| Auto-generated by GitHub Actions. | |
| Includes prebuilt binaries for darwin-arm64 with Node ABI ${{ steps.vars.outputs.abi }}. | |
| branch: "ci/prebuilt-darwin-arm64-${{ steps.vars.outputs.abi }}" | |
| add-paths: | | |
| prebuilt/** |