name: auto build and deploy


on:
  repository_dispatch:
    types: [deploy]
  pull_request:
    branches:
      - main
    types:
      - closed

permissions:
  id-token: write
  contents: read

env:
  NODE_VERSION: "20"
  SVC_NAME: ${{ vars.SVC_NAME }}

run-name: "${{ github.event.action == 'deploy' && format('deploy {0} | {1} | artifact: {2} | env vars: {3}', github.event.client_payload.SVC_NAME, github.event.client_payload.ENV_NAME, github.event.client_payload.VERSION_TO_DEPLOY, github.event.client_payload.ENV_FILE_VERSION) || github.event.action == 'closed' && 'PR merge' || 'Unknown event' }}"


jobs:
  auto_build_and_deploy:
    runs-on: ubuntu-latest
    environment: ${{ github.event.client_payload.ENV_NAME }}
    steps:
      - name: auto build and deploy

        uses: perimeter-81/actions/actions/build_and_deploy/auto@v1


