Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Promotion Workflow #630

Merged
merged 10 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .controlplane/controlplane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ apps:
allow_app_override_by_env: false

# Use a different organization for production.
cpln_org: shakacode-open-source-examples
cpln_org: shakacode-open-source-examples-production

upstream: react-webpack-rails-tutorial-staging

Expand Down
26 changes: 8 additions & 18 deletions .github/workflows/promote-staging-to-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,21 @@ jobs:
runs-on: ubuntu-latest
if: github.event.inputs.confirm_promotion == 'promote'

env:
APP_NAME: react-webpack-rails-tutorial
CPLN_ORG: ${{ secrets.CPLN_ORG }}
UPSTREAM_TOKEN: ${{ secrets.STAGING_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup-environment
env:
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
with:
token: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
org: ${{ vars.CPLN_ORG_PRODUCTION }}

- name: Promote Staging to Production
id: promote
run: |
echo "🚀 Starting promotion from staging to production..."

if ! cpflow promote-app-from-upstream -a "${APP_NAME}" -t "${UPSTREAM_TOKEN}" --org "${CPLN_ORG}"; then
echo "❌ Failed to promote staging to production"
exit 1
fi

echo "✅ Successfully promoted staging to production"
- name: Copy Image from Staging
run: cpflow copy-image-from-upstream -a ${{ vars.PRODUCTION_APP_NAME }} -t ${{ secrets.CPLN_TOKEN_STAGING }}

- name: Deploy Image to Production
run: cpflow deploy-image -a ${{ vars.PRODUCTION_APP_NAME }} --run-release-phase --org ${{ vars.CPLN_ORG_PRODUCTION }}

- name: Create GitHub Release
if: success()
Expand Down
Loading