Skip to content

Deploy main to API nonprod #156

Deploy main to API nonprod

Deploy main to API nonprod #156

Workflow file for this run

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 }}