Ensure all "cd" workflows have workflow_dispatch and we honor the env… #247
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy API | ||
run-name: Deploy ${{ github.ref_name }} to API ${{ inputs.environment || (github.event_name == 'release' && 'prod') || 'nonprod' }} | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- "api/**" | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: "target environment" | ||
required: true | ||
default: "dev" | ||
type: choice | ||
options: | ||
- dev | ||
- staging | ||
- prod | ||
jobs: | ||
api-checks: | ||
name: Run API Checks | ||
uses: ./.github/workflows/ci-api.yml | ||
vulnerability-scans: | ||
name: Vulnerability Scans | ||
uses: ./.github/workflows/vulnerability-scans.yml | ||
with: | ||
app_name: api | ||
deploy: | ||
name: Deploy | ||
needs: [api-checks, vulnerability-scans] | ||
uses: ./.github/workflows/deploy.yml | ||
strategy: | ||
max-parallel: 1 | ||
fail-fast: false | ||
matrix: | ||
<<<<<<< HEAD | ||
envs: ${{ inputs.environment || github.event_name == 'release' && fromJSON('["prod"]') || github.ref_name == 'main' && fromJSON('["dev", "staging"]') || fromJSON('["dev"]') }} | ||
======= | ||
envs: ${{ fromJSON(inputs.environment != null && format('["{0}"]', inputs.environment) || github.event_name == 'release' && '["prod"]' || github.ref_name == 'main' && '["dev", "staging"]' || '["dev"]') }} | ||
>>>>>>> 99b9921a (Ensure all "cd" workflows have workflow_dispatch and we honor the environment if we're in that path) | ||
with: | ||
app_name: "api" | ||
environment: ${{ matrix.envs }} | ||
send-slack-notification: | ||
if: failure() | ||
needs: [api-checks, vulnerability-scans, deploy] | ||
uses: ./.github/workflows/send-slack-notification.yml | ||
secrets: inherit |