Skip to content
6 changes: 3 additions & 3 deletions .github/workflows/delete-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

env:
CPLN_ORG: ${{ secrets.CPLN_ORG }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
APP_NAME: qa-react-webpack-rails-tutorial-pr-${{ github.event.pull_request.number || github.event.issue.number }}
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}

Expand All @@ -34,7 +34,7 @@ jobs:
- name: Validate Required Secrets
run: |
missing_secrets=()
for secret in "CPLN_TOKEN" "CPLN_ORG"; do
for secret in "CPLN_TOKEN_STAGING" "CPLN_ORG_STAGING"; do
if [ -z "${!secret}" ]; then
missing_secrets+=("$secret")
fi
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
org: ${{ env.CPLN_ORG }}
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}

- name: Update Delete Status
if: always()
Expand Down
38 changes: 20 additions & 18 deletions .github/workflows/deploy-to-control-plane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ concurrency:
cancel-in-progress: true

env:
CPLN_ORG: ${{ secrets.CPLN_ORG }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
CPLN_ORG: ${{ secrets.CPLN_ORG_STAGING }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}

jobs:
Process-Deployment-Command:
Expand Down Expand Up @@ -148,14 +148,8 @@ jobs:

const workflowUrl = await getWorkflowUrl(context.runId);
core.exportVariable('WORKFLOW_URL', workflowUrl);
core.exportVariable('GET_CONSOLE_LINK', `
function getConsoleLink(prNumber) {
return '🎮 [Control Plane Console](' +
'https://console.cpln.io/console/org/' + process.env.CPLN_ORG + '/gvc/' + process.env.APP_NAME + '/-info)';
}
`);

- name: Update Status - Building
- name: Set Console Link
if: |
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
Expand All @@ -164,14 +158,25 @@ jobs:
uses: actions/github-script@v7
with:
script: |
eval(process.env.GET_CONSOLE_LINK);
const consoleLink = '🎮 [Control Plane Console](https://console.cpln.io/console/org/' +
process.env.CPLN_ORG + '/gvc/' + process.env.APP_NAME + '/-info)';
core.exportVariable('CONSOLE_LINK', consoleLink);

- name: Update Status - Building
if: |
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/deploy-review-app') ||
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
uses: actions/github-script@v7
with:
script: |
const buildingMessage = [
'🏗️ Building Docker image...',
'',
'📝 [View Build Logs](' + process.env.WORKFLOW_URL + ')',
'',
getConsoleLink(process.env.PR_NUMBER)
process.env.CONSOLE_LINK
].join('\n');

await github.rest.issues.updateComment({
Expand Down Expand Up @@ -211,16 +216,14 @@ jobs:
uses: actions/github-script@v7
with:
script: |
eval(process.env.GET_CONSOLE_LINK);

const deployingMessage = [
'🚀 Deploying to Control Plane...',
'',
'⏳ Waiting for deployment to be ready...',
'',
'📝 [View Deploy Logs](' + process.env.WORKFLOW_URL + ')',
'',
getConsoleLink(process.env.PR_NUMBER)
process.env.CONSOLE_LINK
].join('\n');

await github.rest.issues.updateComment({
Expand All @@ -236,6 +239,7 @@ jobs:
github.event.issue.pull_request &&
github.event.comment.body == '/deploy-review-app') ||
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
id: deploy
uses: ./.github/actions/deploy-to-control-plane
with:
app_name: ${{ env.APP_NAME }}
Expand All @@ -251,16 +255,14 @@ jobs:
uses: actions/github-script@v7
with:
script: |
eval(process.env.GET_CONSOLE_LINK);

const successMessage = [
'✅ Deployment successful!',
'',
'🌐 Review app is ready at: ${{ env.REVIEW_APP_URL }}',
'🌐 Review app is ready at: ${{ steps.deploy.outputs.review_app_url }}',
'',
'📝 [View App Logs](' + process.env.WORKFLOW_URL + ')',
'',
getConsoleLink(process.env.PR_NUMBER)
process.env.CONSOLE_LINK
].join('\n');

await github.rest.issues.updateComment({
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,21 @@ jobs:
'- Provides a unique URL to preview your changes',
'- Shows build and deployment progress in real-time',
'',
'**Required Environment Variables:**',
'- `CPLN_TOKEN`: Control Plane authentication token',
'- `CPLN_ORG`: Control Plane organization name',
'',
'**Optional Configuration:**',
'- `WAIT_TIMEOUT`: Deployment timeout in seconds (default: 900)',
' - Must be a positive integer',
' - Can be set in GitHub Actions variables',
' - Applies to both deployment and workload readiness checks',
'',
'### `/delete-review-app`',
'Deletes the review app associated with this PR.',
'- Removes all resources from Control Plane',
'- Helpful for cleaning up when you\'re done testing',
'- Can be re-deployed later using `/deploy-review-app`',
'',
'**Required Environment Variables:**',
'- `CPLN_TOKEN`: Control Plane authentication token',
'- `CPLN_ORG`: Control Plane organization name',
'',
'### `/help`',
'Shows this detailed help message.',
'',
'---',
'## Environment Setup',
'',
'1. Set required secrets in your repository settings:',
' - `CPLN_TOKEN`',
' - `CPLN_ORG`',
' - `CPLN_TOKEN_STAGING`',
' - `CPLN_ORG_STAGING`',
'',
'2. Optional: Configure `WAIT_TIMEOUT` in GitHub Actions variables to customize deployment timeout',
'',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/promote-staging-to-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup-environment
env:
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}

- name: Promote Staging to Production
id: promote
Expand Down
Loading