Deploy main to API nonprod #156
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 | |
# Need to set a default value for when the workflow is triggered from a git push | |
# which bypasses the default configuration for inputs | |
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 | |
deploy: | |
name: Deploy | |
needs: api-checks | |
uses: ./.github/workflows/deploy.yml | |
strategy: | |
matrix: | |
envs: ${{ github.event_name == 'release' && fromJSON('["prod"]') || github.ref_name == 'main' && fromJSON('["dev", "staging"]') || fromJSON('["dev"]') }} | |
with: | |
app_name: "api" | |
environment: ${{ matrix.envs }} |