mirror of
https://github.com/RWejlgaard/pez-infra.git
synced 2026-10-31 19:11:03 +00:00
* 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
49 lines
1.2 KiB
YAML
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
|