Nightly Build #971
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-22.04 | |
outputs: | |
status: ${{ steps.decision.outputs.status }} | |
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=$(git ls-remote https://github.com/FFmpeg/FFmpeg.git HEAD | cut -c1-9) | |
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-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [win32, 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 }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ffmpeg | |
path: artifacts/ | |
retention-days: 1 | |
publish_release: | |
name: Publish release | |
needs: build_ffmpeg | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ffmpeg | |
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 '*.7z' | head -1 | xargs -I{} basename {}) | |
REV=$(echo $STUB | cut -d'-' -f5) | |
NTAG=$(echo $STUB | cut -d'-' -f3) | |
TITLE="Build $BUILDID @ $REV" | |
BODY="Built from FFmpeg/FFmpeg@$REV" | |
TAGNAME="build-$BUILDID-n$NTAG" | |
gh release create $TAGNAME $(for a in artifacts/*.7z; do echo $a; done) -t "$TITLE" -n "$BODY" |