Skip to content

Nightly next build

Nightly next build #51

name: Nightly next build
# Dispatches a build on the next branch every night at 03:00 UTC.
#
# Why a separate workflow instead of a schedule in build.yml:
# GitHub schedule events always run on the default branch. build.yml on
# main cannot directly trigger a build on next via schedule.
#
# Timing rationale:
# - gnome-build-meta nightly finishes ~08:00 UTC
# - track-next-junctions opens PR 20:00 UTC (artifacts confirmed in CAS)
# - junction PR auto-merges ~21:00 UTC
# - this workflow fires 03:00 UTC (+6 h margin, US off-hours)
#
# The build triggered here runs through the normal build.yml → publish.yml
# chain, so :next and :btw tags are updated automatically on success.
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
# Join the global BST concurrency group so this dispatcher waits behind
# any in-flight BuildStream build on testing or any merge-queue ref. The
# actual BST run is on build.yml (whose `build` job also joins this
# group), so this serves as defense in depth — preventing the dispatcher
# from queueing a second build before the first one releases the CAS.
# cancel-in-progress: false so a running build is never killed by a
# scheduled dispatch.
concurrency:
group: dakota-bst-build-global
cancel-in-progress: false
jobs:
dispatch:
name: Trigger next branch build
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Check for active next build
id: check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
active=$(gh run list \
--repo "${{ github.repository }}" \
--workflow build.yml \
--branch next \
--status in_progress \
--json databaseId \
--jq 'length')
queued=$(gh run list \
--repo "${{ github.repository }}" \
--workflow build.yml \
--branch next \
--status queued \
--json databaseId \
--jq 'length')
total=$((active + queued))
if [ "$total" -gt 0 ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "Next build already running or queued ($total run(s)) — skipping dispatch"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Dispatch build.yml on next
if: steps.check.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run build.yml \
--repo "${{ github.repository }}" \
--ref next
echo "Build dispatched on next branch"