Update web-deploy.yml
This commit is contained in:
parent
4d85546901
commit
1277b25834
1 changed files with 36 additions and 1 deletions
37
.github/workflows/web-deploy.yml
vendored
37
.github/workflows/web-deploy.yml
vendored
|
|
@ -1,6 +1,16 @@
|
||||||
name: Web Deployment
|
name: Web Deployment
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: {}
|
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:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
@ -15,8 +25,33 @@ on:
|
||||||
paths:
|
paths:
|
||||||
- web/**
|
- web/**
|
||||||
jobs:
|
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:
|
build:
|
||||||
environment: dev
|
environment: dev
|
||||||
|
needs: determine-workflow
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -36,7 +71,7 @@ jobs:
|
||||||
deploy:
|
deploy:
|
||||||
environment: dev
|
environment: dev
|
||||||
needs: build
|
needs: build
|
||||||
if: always() && needs.build.result == 'success'
|
if: always() && needs.build.result == 'success' && ${{ steps.workflow.outputs.workflow_type }} == 'release'
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue