🛠️ Adding back in failure steps. (4394dd28d3958a8afe1f84d0b8a71c465d9e3e60) #82
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
# PLANNING STEPS: | |
# ===================== | |
# Discover Changes | |
# Build Artifact | |
# Deploy Artifact | |
# Create Infrastructure | |
# Apply Configuration | |
# Install App | |
# Test New Version | |
# Promote New Version | |
# Kill Old Version | |
name: Blue-Green CI/CD Pipeline | |
run-name: "🛠️ ${{ github.event.head_commit.message }} (${{ github.sha }})" | |
on: | |
push: | |
branches: | |
- blue-green-demo #normally 'main' | |
jobs: | |
ci-frontend: | |
uses: ./.github/workflows/ci-frontend.yml | |
with: | |
ref: ${{ github.sha }} | |
ci-backend: | |
uses: ./.github/workflows/ci-backend.yml | |
with: | |
ref: ${{ github.sha }} | |
cd-backend: | |
needs: [ci-frontend, ci-backend] | |
uses: ./.github/workflows/cd-backend.yml | |
with: | |
ref: ${{ github.sha }} | |
secrets: inherit | |
cd-frontend: | |
needs: [cd-backend] | |
uses: ./.github/workflows/cd-frontend.yml | |
with: | |
ref: ${{ github.sha }} | |
backend_url: ${{ needs.cd-backend.outputs.backend_url }} | |
secrets: inherit | |
promote: | |
needs: [cd-frontend] | |
uses: ./.github/workflows/promote.yml | |
with: | |
ref: ${{ github.sha }} | |
s3_bucket_hostname: ${{ needs.cd-frontend.outputs.s3_bucket_hostname }} | |
secrets: inherit | |
cleanup: | |
needs: [promote] | |
uses: ./.github/workflows/cleanup.yml | |
with: | |
ref: ${{ needs.promote.outputs.previous_ref }} | |
env_name: Previous Blue | |
reason: decommissioning | |
secrets: inherit | |
failure: | |
needs: [cd-backend, cd-frontend, promote] | |
# We need some extra logic to prevent cleanup when a CI failure | |
if: | | |
failure() && ( | |
needs.cd-backend.result != 'skipped' || | |
needs.cd-frontend.result != 'skipped' || | |
needs.promote.result != 'skipped' | |
) | |
uses: ./.github/workflows/cleanup.yml | |
with: | |
ref: ${{ github.sha }} | |
env_name: Green | |
reason: failure | |
secrets: inherit |