Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JustinJohnWilliams/148338caa03a0b55384179d5ea109ad3 to your computer and use it in GitHub Desktop.
Save JustinJohnWilliams/148338caa03a0b55384179d5ea109ad3 to your computer and use it in GitHub Desktop.
approval gate gha
name: CI + CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
manual_approval:
description: 'manual approval for production'
required: true
default: false
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: compile
run: echo Howdy, Partner!
DeploySandbox:
name: Deploy to Sandbox
if: github.event_name == 'pull_request'
needs: [Build]
runs-on: ubuntu-latest
environment:
name: sandbox
steps:
- name: Deploy
run: echo Deploying to sandbox!
DeployStaging:
name: Deploy to Staging
if: github.event.ref == 'refs/heads/main'
needs: [Build]
runs-on: ubuntu-latest
environment:
name: staging
steps:
- name: Deploy
run: echo Deploying to staging!
ApprovalGate:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.manual_approval == 'true' }}
steps:
- name: Manual Approval Gate
id: approval
run: echo "Click the button to approve deployment to Prod"
DeployProd:
name: Deploy to Production
needs: [DeployStaging, ApprovalGate]
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.manual_approval == 'true'
environment:
name: prod
steps:
- name: Deploy
run: echo Deploying to prod!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment