# Pushes rigg-managed configuration to Azure on merge to main.
# Generated by `rigg ci init`.
name: rigg deploy

on:
  push:
    branches: [main]

permissions:
  id-token: write
  contents: read

concurrency: rigg-deploy-{{RIGG_ENV}}

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install rigg
        run: cargo install rigg --locked

      - name: Azure login (OIDC)
        uses: azure/login@v2
        with:
          client-id: ${{ vars.AZURE_CLIENT_ID }}
          tenant-id: ${{ vars.AZURE_TENANT_ID }}
          subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}

      - name: Validate
        run: rigg validate --strict

      - name: Push all projects to {{RIGG_ENV}}
        run: rigg push --all --env {{RIGG_ENV}} --yes
