Skip to content

Updates for Github Actions for Staging and Production #619

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

Closed
wants to merge 14 commits into from
Prev Previous commit
Next Next commit
fix-missing-url
  • Loading branch information
justin808 committed Jan 27, 2025
commit a4b0353c0aa7609d2c57aba637bf99d2ccd5d98c
34 changes: 18 additions & 16 deletions .github/workflows/deploy-to-control-plane.yml
Original file line number Diff line number Diff line change
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
Loading