Nightly Build #1392
This file contains 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: Nightly Build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 21 * * *' # Runs at 06:00 Tokyo time every day 🕕 | |
jobs: | |
decision_task: | |
name: Determine whether to perform Nightly build | |
runs-on: ubuntu-24.04 | |
outputs: | |
status: ${{ steps.decision.outputs.status }} | |
commit: ${{ steps.decision.outputs.ffmpeg_commit }} | |
steps: | |
- name: Take a decision | |
id: decision | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
set -xe | |
LATEST_RELEASE=$(gh api repos/${{ github.repository }}/releases/latest --jq '.body' | cut -d@ -f2) | |
FFMPEG_LATEST=$(gh api repos/FFmpeg/FFmpeg/commits/master --jq '.sha' | cut -c1-9) | |
echo "ffmpeg_commit=${FFMPEG_LATEST}" >> "$GITHUB_OUTPUT" | |
if [[ "$LATEST_RELEASE" == "$FFMPEG_LATEST" ]]; then | |
echo "status=skip" >> "$GITHUB_OUTPUT" | |
else | |
echo "status=proceed" >> "$GITHUB_OUTPUT" | |
fi | |
build_ffmpeg: | |
needs: decision_task | |
if: needs.decision_task.outputs.status == 'proceed' | |
name: Build ffmpeg | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [win64] | |
variant: [nonfree, nonfree-shared] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.dodosolsollalasol }} | |
- name: Build ffmpeg | |
run: ./build.sh ${{ matrix.target }} ${{ matrix.variant }} | |
env: | |
FFMPEG_COMMIT: ${{ needs.decision_task.outputs.commit }} | |
- name: Replace spaces in artifact name | |
id: artifact | |
run: | | |
REF="${{ matrix.target }}-${{ matrix.variant }}" | |
echo "name=${REF// /-}" >> "$GITHUB_OUTPUT" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ffmpeg-${{ steps.artifact.outputs.name }} | |
path: artifacts/ | |
retention-days: 1 | |
publish_release: | |
name: Publish release | |
needs: build_ffmpeg | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Create release | |
id: create_release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
set -xe | |
BUILDID=$(date +'%Y-%m-%d-%H-%M') | |
STUB=$(find artifacts -iname '*.zst' | head -1 | xargs -I{} basename {}) | |
REV=$(echo "$STUB" | cut -d'-' -f5) | |
NTAG=$(echo "$STUB" | cut -d'-' -f3) | |
TITLE="Build $BUILDID" | |
RELNOTE="Built from FFmpeg/FFmpeg@$REV" | |
TAGNAME="build-$BUILDID-n$NTAG" | |
gh release create "$TAGNAME" \ | |
--title "$TITLE" \ | |
--notes "$RELNOTE" \ | |
artifacts/*/*.zst |