Promote Staging to Production #11
Workflow file for this run
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
name: Promote Staging to Production | |
on: | |
workflow_dispatch: | |
inputs: | |
confirm_promotion: | |
description: 'Type "promote" to confirm promotion of staging to production' | |
required: true | |
type: string | |
jobs: | |
promote-to-production: | |
runs-on: ubuntu-latest | |
if: github.event.inputs.confirm_promotion == 'promote' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Environment | |
uses: ./.github/actions/setup-environment | |
with: | |
token: ${{ secrets.CPLN_TOKEN_PRODUCTION }} | |
org: ${{ vars.CPLN_ORG_PRODUCTION }} | |
- name: Copy Image from Staging | |
run: cpflow copy-image-from-upstream -a "${{ vars.STAGING_APP_NAME }}" -t "${{ secrets.CPLN_TOKEN_STAGING }}" -v | |
- name: Deploy Image to Production | |
run: cpflow deploy-image -v --run-release-phase | |
- name: Create GitHub Release | |
if: success() | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Get the current date in YYYY-MM-DD format | |
RELEASE_DATE=$(date '+%Y-%m-%d') | |
# Create a release tag | |
RELEASE_TAG="production-${RELEASE_DATE}" | |
# Create GitHub release | |
gh release create "${RELEASE_TAG}" \ | |
--title "Production Release ${RELEASE_DATE}" \ | |
--notes "🚀 Production deployment on ${RELEASE_DATE}" |