pez-infra/.github/workflows/deploy-on-merge.yml
Rasmus "Pez" Wejlgaard b70a3fb244
Some checks failed
Terraform / Plan (push) Has been cancelled
Terraform / Apply (push) Has been cancelled
Daily midday fleet deploy (#149)
* 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.

* also do terraform
2026-09-14 20:33:33 +01:00

49 lines
1.2 KiB
YAML

name: Deploy (on merge + daily)
on:
push:
branches:
- main
paths-ignore:
- "terraform/**"
- "docs/**"
- "**/*.md"
- ".github/**"
schedule:
- cron: "0 11 * * *"
# Serialize fleet deploys so two quick merges 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