pez-infra/.github/workflows/deploy-on-merge.yml
Rasmus Wejlgaard faca154a7e Run the fleet deploy every day at midday
Adds a schedule trigger to deploy-on-merge so deploy.yml also runs daily
at 11:00 UTC (noon London time in BST). It shares the existing concurrency
group, so it queues behind a merge deploy instead of overlapping it.
2026-09-14 20:05:34 +01:00

52 lines
1.3 KiB
YAML

name: Deploy (on merge + daily)
on:
push:
branches:
- main
paths-ignore:
- "terraform/**"
- "docs/**"
- "**/*.md"
- ".github/**"
# Daily fleet deploy at midday to catch drift from anything changed by hand.
# Cron is UTC: 11:00 UTC is 12:00 in London during BST, 11:00 during GMT.
schedule:
- cron: "0 11 * * *"
# Serialize fleet deploys so two quick merges (or a merge and the daily run)
# can't run Ansible against the same hosts at once. Don't cancel an in-flight
# deploy mid-run — queue it.
concurrency:
group: deploy-on-merge
cancel-in-progress: false
jobs:
discover:
name: Discover hosts
runs-on: ubuntu-latest
outputs:
hosts: ${{ steps.discover.outputs.hosts }}
steps:
- uses: actions/checkout@v7
- name: Read hosts from inventory
id: discover
run: |
HOSTS=$(grep 'ansible_host=' ansible/inventory/hosts.ini | awk '{print $1}' | jq -R . | jq -cs .)
echo "hosts=$HOSTS" >> "$GITHUB_OUTPUT"
deploy:
needs: discover
strategy:
matrix:
host: ${{ fromJson(needs.discover.outputs.hosts) }}
fail-fast: false
permissions:
id-token: write
uses: ./.github/workflows/_deploy-core.yml
with:
host: ${{ matrix.host }}
playbook: deploy.yml
dry_run: false
secrets: inherit