Update web-deploy.yml

This commit is contained in:
Matt DiMeglio 2025-06-11 13:15:27 -04:00 committed by GitHub
parent 4d85546901
commit 1277b25834
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,16 @@
name: Web Deployment
on:
workflow_dispatch: {}
workflow_call:
inputs:
develop-environments:
type: string
description: An optional list of dev environments to deploy to.
default: '["dev"]'
release-environments:
type: string
description: An optional list of release environments to deploy to.
default: '["prod"]'
pull_request:
branches:
- main
@ -15,8 +25,33 @@ on:
paths:
- web/**
jobs:
determine-workflow:
runs-on: 'ubuntu-latest'
outputs:
workflow_type: ${{ steps.workflow.outputs.workflow_type }}
workflow_envs: ${{ steps.workflow.outputs.workflow_envs }}
release_type: ${{ steps.workflow.outputs.release_type }}
steps:
- name: Determine Workflow
id: workflow
shell: bash
run: |
event=${{ github.event_name }}
workflow_type='dev';
workflow_envs='${{ inputs.develop-environments }}'
if [[ $event == 'workflow_dispatch' && ${{ github.ref_name }}' == 'main' ]];
then
workflow_type='release';
workflow_envs='${{ inputs.release-environments }}'
fi
echo "workflow_type=$workflow_type" >> $GITHUB_OUTPUT
echo "workflow_envs=$workflow_envs" >> $GITHUB_OUTPUT
echo "Running #workflow_type pipeline in environments: $workflow_envs" >> $GITHUB_STEP_SUMMARY
build:
environment: dev
needs: determine-workflow
runs-on: 'ubuntu-latest'
permissions:
contents: read
@ -36,7 +71,7 @@ jobs:
deploy:
environment: dev
needs: build
if: always() && needs.build.result == 'success'
if: always() && needs.build.result == 'success' && ${{ steps.workflow.outputs.workflow_type }} == 'release'
runs-on: 'ubuntu-latest'
permissions:
contents: read