build #384
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| doRelease: | |
| description: "Publish new release" | |
| type: boolean | |
| default: false | |
| required: false | |
| schedule: | |
| - cron: "0 2 * * *" | |
| env: | |
| REGISTRY: ghcr.io | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build_linux: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [linux/amd64, linux/arm64] | |
| branch: [master, feature/transcode2] | |
| # Build each arch on a native runner so docker buildx never emulates: | |
| # foreign-arch QEMU segfaults glibc ldconfig (libc-bin trigger -> "qemu: | |
| # uncaught target signal 11"), which broke the arm64 leg. ubuntu-24.04-arm | |
| # is GA and free for public repos. | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: prepare | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y wget | |
| - name: build zlmediakit package | |
| run: | | |
| chmod +x ./build.sh | |
| ./build.sh --platform ${{ matrix.platform }} --branch ${{ matrix.branch }} | |
| - name: Replace spaces in string | |
| id: strs | |
| run: | | |
| SLUG="$(echo ${{ matrix.platform }} | tr '/' '_')-$(echo ${{ matrix.branch }} | tr '/' '_')" | |
| echo "artifact_slug=${SLUG// /-}" >> $GITHUB_OUTPUT | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zlmediakit-${{ steps.strs.outputs.artifact_slug }} | |
| overwrite: true | |
| path: artifacts/* | |
| release_zlmediakit: | |
| needs: [build_linux, build_macos, build_windows] | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.doRelease == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: zlmediakit-* | |
| merge-multiple: true | |
| path: artifacts | |
| - name: Create release | |
| id: create_release | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.doRelease == 'true' }} | |
| run: | | |
| set -xe | |
| shopt -s nullglob | |
| RELDATE="$(date +'%Y-%m-%d')" | |
| NAME="Auto-Build $RELDATE" | |
| TAGNAME="autobuild-$(date +'%Y-%m-%d')" | |
| (cd artifacts && sha256sum *.{zip,tar.gz} > checksums.sha256) | |
| gh release create "$TAGNAME" --target "main" --title "$NAME" artifacts/*.{zip,tar.gz} artifacts/checksums.* | |
| echo "tag_name=${TAGNAME}" >> $GITHUB_OUTPUT | |
| echo "rel_date=${RELDATE}" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| build_macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: macos-13 | |
| - arch: arm64 | |
| runner: macos-latest | |
| branch: [master] | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: build zlmediakit package (macOS) | |
| run: | | |
| chmod +x ./build-macos.sh | |
| ./build-macos.sh --branch ${{ matrix.branch }} --arch ${{ matrix.arch }} | |
| - name: Replace spaces in string | |
| id: strs | |
| run: | | |
| SLUG="macos_${{ matrix.arch }}-$(echo ${{ matrix.branch }} | tr '/' '_')" | |
| echo "artifact_slug=${SLUG// /-}" >> $GITHUB_OUTPUT | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zlmediakit-${{ steps.strs.outputs.artifact_slug }} | |
| overwrite: true | |
| path: artifacts/* | |
| build_windows: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [amd64, arm64] | |
| branch: [master] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Build zlmediakit package (Windows) | |
| shell: pwsh | |
| run: | | |
| ./build-windows.ps1 -Branch "${{ matrix.branch }}" -Arch "${{ matrix.arch }}" | |
| - name: Replace spaces in string | |
| id: strs | |
| shell: pwsh | |
| run: | | |
| $slug = "windows_${{ matrix.arch }}-${{ matrix.branch }}".Replace("/", "_").Replace(" ", "-") | |
| "artifact_slug=$slug" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zlmediakit-${{ steps.strs.outputs.artifact_slug }} | |
| overwrite: true | |
| path: artifacts/* |