Skip to content

build

build #24

Workflow file for this run

name: build
on:
push:
branches:
- main
workflow_dispatch:
inputs:
doRelease:
description: "Publish new release"
type: boolean
default: false
required: false
schedule:
- cron: "0 0 * * 0" # 每周日运行一次
env:
REGISTRY: ghcr.io
jobs:
build_zlmediakit:
strategy:
fail-fast: false
matrix:
platform: [linux/amd64]
branch: [master]
# platform: [linux/amd64, linux/arm64]
# branch: [master, feature/transcode2]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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_zlmediakit
if: ${{ github.event_name == 'schedule' || github.event.inputs.doRelease == 'true' }}
runs-on: ubuntu-latest
steps:
- 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 "master" --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 }}