Skip to content

Promote Staging to Production #14

Promote Staging to Production

Promote Staging to Production #14

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.PRODUCTION_APP_NAME }}" -t "${{ secrets.CPLN_TOKEN_STAGING }}" --verbose --trace
- 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}"