From cc06e02df0e82da7313fb6d2242c50b43dbd68d1 Mon Sep 17 00:00:00 2001 From: shrunyan Date: Tue, 19 Mar 2024 14:58:03 -0700 Subject: [PATCH 1/4] fix: split cd by environment --- .github/workflows/cd-beta.yaml | 100 +++++++++++ .../workflows/{cd.yaml => cd-dev-stage.yaml} | 166 +++++++++--------- .github/workflows/cd-stable.yaml | 87 +++++++++ 3 files changed, 272 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/cd-beta.yaml rename .github/workflows/{cd.yaml => cd-dev-stage.yaml} (51%) create mode 100644 .github/workflows/cd-stable.yaml diff --git a/.github/workflows/cd-beta.yaml b/.github/workflows/cd-beta.yaml new file mode 100644 index 0000000000..814d158f15 --- /dev/null +++ b/.github/workflows/cd-beta.yaml @@ -0,0 +1,100 @@ +# name: cd-beta + +# on: +# # Uncomment to work on CD in development mode. +# # pull_request: +# # branches: [ master ] +# push: +# branches: +# - beta + +# jobs: +# deploy_to_beta: +# runs-on: ubuntu-latest +# env: +# ENV: "beta" + +# steps: +# # This Clean step simply checks if there's already a workflow running from the last +# # commit and cancels it if there is. This helps us save on cloud cost in the long run. +# # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. +# - name: Clean +# uses: rokroskar/workflow-run-cleanup-action@v0.2.2 +# env: +# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" +# if: "github.ref != 'refs/heads/master'" +# - name: Checkout Repo +# uses: actions/checkout@v2 +# - name: Auth with Gcloud +# uses: google-github-actions/auth@v0 +# with: +# credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} +# - name: Set up Gcloud SDK +# uses: google-github-actions/setup-gcloud@v0 +# with: +# project_id: zesty-dev +# - name: Set up Node +# uses: actions/setup-node@v2 +# with: +# node-version: "16.5.0" +# cache: "npm" +# cache-dependency-path: package-lock.json +# - name: Install Dependencies +# run: npm install +# - name: Build +# run: npm run build:dev +# env: +# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} +# - name: Deploy to Dev +# run: gcloud app deploy app.yaml --quiet --project zesty-dev +# - name: Post Successful Dev Deploy Notification To Slack +# uses: rtCamp/action-slack-notify@v2 +# env: +# SLACK_CHANNEL: devops +# SLACK_COLOR: ${{ job.status }} +# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png +# SLACK_MESSAGE: | +# Use :eyes: to signal you have seen this message. +# Use :white_check_mark: to signal you have successfully manually tested the deployed changes. +# Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. +# SLACK_TITLE: Successfully Deployed manager-ui to Dev +# SLACK_USERNAME: Deploy Bot +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} +# cancel_workflow_if_beta_deploy_failed: +# runs-on: ubuntu-latest +# if: ${{ failure() }} +# needs: +# - deploy_to_beta +# steps: +# - name: Post Failed Beta Deploy Notification To Slack +# uses: rtCamp/action-slack-notify@v2 +# env: +# SLACK_CHANNEL: devops +# SLACK_COLOR: "#FF0000" +# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png +# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to beta." +# SLACK_TITLE: Beta Deployment Failed for manager-ui +# SLACK_USERNAME: Deploy Bot +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} +# - name: Cancel current workflow run +# uses: actions/github-script@v4 +# with: +# script: | +# github.actions.cancelWorkflowRun({ +# owner: context.repo.owner, +# repo: context.repo.repo, +# run_id: context.runId +# }) +# create_stable_pr: +# runs-on: ubuntu-latest +# needs: +# - deploy_to_beta + +# steps: +# - name: Create Stable Release PR +# uses: peter-evans/create-pull-request@v6 +# with: +# branch: beta +# base: master +# title: master +# # labels: diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd-dev-stage.yaml similarity index 51% rename from .github/workflows/cd.yaml rename to .github/workflows/cd-dev-stage.yaml index 4def727501..bc9e2a6b99 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd-dev-stage.yaml @@ -1,4 +1,4 @@ -name: cd +name: cd-dev-stage on: # Uncomment to work on CD in development mode. @@ -7,8 +7,6 @@ on: push: branches: - dev - workflow_dispatch: - jobs: deploy_to_dev: runs-on: ubuntu-latest @@ -61,13 +59,6 @@ jobs: SLACK_TITLE: Successfully Deployed manager-ui to Dev SLACK_USERNAME: Deploy Bot SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - branch: dev - base: beta - title: beta - # labels: cancel_workflow_if_dev_deploy_failed: runs-on: ubuntu-latest if: ${{ failure() }} @@ -93,76 +84,89 @@ jobs: repo: context.repo.repo, run_id: context.runId }) - # create_beta_pr: - # runs-on: ubuntu-latest - # steps: - # deploy_to_stage: - # runs-on: ubuntu-latest - # env: - # ENV: "stage" - # needs: - # - deploy_to_dev + deploy_to_stage: + runs-on: ubuntu-latest + env: + ENV: "stage" + needs: + - deploy_to_dev - # steps: - # # This Clean step simply checks if there's already a workflow running from the last - # # commit and cancels it if there is. This helps us save on cloud cost in the long run. - # # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. - # - name: Clean - # uses: rokroskar/workflow-run-cleanup-action@v0.2.2 - # env: - # GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - # if: "github.ref != 'refs/heads/master'" - # - name: Checkout Repo - # uses: actions/checkout@v2 - # - name: Auth with Gcloud - # uses: google-github-actions/auth@v0 - # with: - # credentials_json: ${{ secrets.GCP_SA_KEY }} - # - name: Set up Gcloud SDK - # uses: google-github-actions/setup-gcloud@v0 - # with: - # project_id: zesty-stage - # - name: Set up Node - # uses: actions/setup-node@v2 - # with: - # node-version: "16.5.0" - # cache: "npm" - # cache-dependency-path: package-lock.json - # - name: Install Dependencies - # run: npm install - # - name: Build - # run: npm run build:stage - # env: - # SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - # - name: Deploy to Staging - # run: gcloud app deploy app.yaml --quiet --project zesty-stage - # - name: Post Successful Stage Deploy Notification To Slack - # uses: rtCamp/action-slack-notify@v2 - # env: - # SLACK_CHANNEL: devops - # SLACK_COLOR: ${{ job.status }} - # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - # SLACK_MESSAGE: | - # Use :eyes: to signal you have seen this message. - # Use :white_check_mark: to signal you have successfully manually tested the deployed changes. - # Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. - # SLACK_TITLE: Successfully Deployed manager-ui to Stage - # SLACK_USERNAME: Deploy Bot - # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - # post_failed_stage_deploy_notification_to_slack: - # runs-on: ubuntu-latest - # if: ${{ failure() }} - # needs: - # - deploy_to_stage - # steps: - # - name: Post Failed Staging Deploy Notification To Slack - # uses: rtCamp/action-slack-notify@v2 - # env: - # SLACK_CHANNEL: devops - # SLACK_COLOR: "#FF0000" - # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - # SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to staging." - # SLACK_TITLE: Staging Deployment Failed for manager-ui - # SLACK_USERNAME: Deploy Bot - # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + steps: + # This Clean step simply checks if there's already a workflow running from the last + # commit and cancels it if there is. This helps us save on cloud cost in the long run. + # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. + - name: Clean + uses: rokroskar/workflow-run-cleanup-action@v0.2.2 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "github.ref != 'refs/heads/master'" + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Auth with Gcloud + uses: google-github-actions/auth@v0 + with: + credentials_json: ${{ secrets.GCP_SA_KEY }} + - name: Set up Gcloud SDK + uses: google-github-actions/setup-gcloud@v0 + with: + project_id: zesty-stage + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: "16.5.0" + cache: "npm" + cache-dependency-path: package-lock.json + - name: Install Dependencies + run: npm install + - name: Build + run: npm run build:stage + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + - name: Deploy to Staging + run: gcloud app deploy app.yaml --quiet --project zesty-stage + - name: Post Successful Stage Deploy Notification To Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: devops + SLACK_COLOR: ${{ job.status }} + SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png + SLACK_MESSAGE: | + Use :eyes: to signal you have seen this message. + Use :white_check_mark: to signal you have successfully manually tested the deployed changes. + Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. + SLACK_TITLE: Successfully Deployed manager-ui to Stage + SLACK_USERNAME: Deploy Bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + post_failed_stage_deploy_notification_to_slack: + runs-on: ubuntu-latest + if: ${{ failure() }} + needs: + - deploy_to_stage + steps: + - name: Post Failed Staging Deploy Notification To Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: devops + SLACK_COLOR: "#FF0000" + SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png + SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to staging." + SLACK_TITLE: Staging Deployment Failed for manager-ui + SLACK_USERNAME: Deploy Bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + create_beta_pr: + runs-on: ubuntu-latest + needs: + - deploy_to_dev + - deploy_to_stage + + steps: + - uses: actions/checkout@v4 + - name: Create Beta Release PR + uses: peter-evans/create-pull-request@v6 + with: + branch: dev + base: beta + title: beta + # labels: diff --git a/.github/workflows/cd-stable.yaml b/.github/workflows/cd-stable.yaml new file mode 100644 index 0000000000..0993a50d8e --- /dev/null +++ b/.github/workflows/cd-stable.yaml @@ -0,0 +1,87 @@ +# name: cd-stable + +# on: +# # Uncomment to work on CD in development mode. +# # pull_request: +# # branches: [ master ] +# push: +# branches: +# - master + +# jobs: +# deploy_to_stable: +# runs-on: ubuntu-latest +# env: +# ENV: "stable" + +# steps: +# # This Clean step simply checks if there's already a workflow running from the last +# # commit and cancels it if there is. This helps us save on cloud cost in the long run. +# # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. +# - name: Clean +# uses: rokroskar/workflow-run-cleanup-action@v0.2.2 +# env: +# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" +# if: "github.ref != 'refs/heads/master'" +# - name: Checkout Repo +# uses: actions/checkout@v2 +# - name: Auth with Gcloud +# uses: google-github-actions/auth@v0 +# with: +# credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} +# - name: Set up Gcloud SDK +# uses: google-github-actions/setup-gcloud@v0 +# with: +# project_id: zesty-dev +# - name: Set up Node +# uses: actions/setup-node@v2 +# with: +# node-version: "16.5.0" +# cache: "npm" +# cache-dependency-path: package-lock.json +# - name: Install Dependencies +# run: npm install +# - name: Build +# run: npm run build:dev +# env: +# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} +# - name: Deploy to Dev +# run: gcloud app deploy app.yaml --quiet --project zesty-dev +# - name: Post Successful Dev Deploy Notification To Slack +# uses: rtCamp/action-slack-notify@v2 +# env: +# SLACK_CHANNEL: devops +# SLACK_COLOR: ${{ job.status }} +# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png +# SLACK_MESSAGE: | +# Use :eyes: to signal you have seen this message. +# Use :white_check_mark: to signal you have successfully manually tested the deployed changes. +# Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. +# SLACK_TITLE: Successfully Deployed manager-ui to Dev +# SLACK_USERNAME: Deploy Bot +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} +# cancel_workflow_if_beta_deploy_failed: +# runs-on: ubuntu-latest +# if: ${{ failure() }} +# needs: +# - deploy_to_stable +# steps: +# - name: Post Failed Dev Deploy Notification To Slack +# uses: rtCamp/action-slack-notify@v2 +# env: +# SLACK_CHANNEL: devops +# SLACK_COLOR: "#FF0000" +# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png +# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to dev." +# SLACK_TITLE: Dev Deployment Failed for manager-ui +# SLACK_USERNAME: Deploy Bot +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} +# - name: Cancel current workflow run +# uses: actions/github-script@v4 +# with: +# script: | +# github.actions.cancelWorkflowRun({ +# owner: context.repo.owner, +# repo: context.repo.repo, +# run_id: context.runId +# }) From 9103360b8fca5fc71fc6c6f4b7cfd15801a86501 Mon Sep 17 00:00:00 2001 From: shrunyan Date: Tue, 19 Mar 2024 15:20:02 -0700 Subject: [PATCH 2/4] improve slack alerts for cd --- .github/workflows/cd-dev-stage.yaml | 62 ++++++++++++----------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/.github/workflows/cd-dev-stage.yaml b/.github/workflows/cd-dev-stage.yaml index bc9e2a6b99..1aa1f4a8d2 100644 --- a/.github/workflows/cd-dev-stage.yaml +++ b/.github/workflows/cd-dev-stage.yaml @@ -59,38 +59,10 @@ jobs: SLACK_TITLE: Successfully Deployed manager-ui to Dev SLACK_USERNAME: Deploy Bot SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - cancel_workflow_if_dev_deploy_failed: - runs-on: ubuntu-latest - if: ${{ failure() }} - needs: - - deploy_to_dev - steps: - - name: Post Failed Dev Deploy Notification To Slack - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: devops - SLACK_COLOR: "#FF0000" - SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to dev." - SLACK_TITLE: Dev Deployment Failed for manager-ui - SLACK_USERNAME: Deploy Bot - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - - name: Cancel current workflow run - uses: actions/github-script@v4 - with: - script: | - github.actions.cancelWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.runId - }) - deploy_to_stage: runs-on: ubuntu-latest env: ENV: "stage" - needs: - - deploy_to_dev steps: # This Clean step simply checks if there's already a workflow running from the last @@ -138,20 +110,36 @@ jobs: SLACK_TITLE: Successfully Deployed manager-ui to Stage SLACK_USERNAME: Deploy Bot SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - post_failed_stage_deploy_notification_to_slack: + + failed_deploy_notification_to_slack: runs-on: ubuntu-latest if: ${{ failure() }} - needs: - - deploy_to_stage + needs: [deploy_to_dev, deploy_to_stage] steps: - - name: Post Failed Staging Deploy Notification To Slack + - name: Failed Deploy Notification To Slack uses: rtCamp/action-slack-notify@v2 env: - SLACK_CHANNEL: devops + SLACK_CHANNEL: code-deploy + SLACK_COLOR: "#FF0000" + SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png + SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." + SLACK_TITLE: Deployment Failed for manager-ui + SLACK_USERNAME: Deploy Bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + success_deploy_notification_to_slack: + runs-on: ubuntu-latest + if: ${{ success() }} + needs: [deploy_to_stage] + steps: + - name: Success Deploy Notification To Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: code-deploy SLACK_COLOR: "#FF0000" SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to staging." - SLACK_TITLE: Staging Deployment Failed for manager-ui + SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." + SLACK_TITLE: Stage Deployment for manager-ui SLACK_USERNAME: Deploy Bot SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} @@ -166,7 +154,7 @@ jobs: - name: Create Beta Release PR uses: peter-evans/create-pull-request@v6 with: - branch: dev - base: beta + branch: beta + # base: dev title: beta # labels: From 26ab502a5acc0ee484726bde5d7d91a7521986f0 Mon Sep 17 00:00:00 2001 From: Stuart Runyan Date: Tue, 19 Mar 2024 15:34:55 -0700 Subject: [PATCH 3/4] testing new branching strategy CD (#2598) From 604c31da0772ca2d93f2e1b5a174775cac04fcbf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 20 Mar 2024 12:45:45 -0700 Subject: [PATCH 4/4] Beta Release (#2602) * WIP: branching strategy * bump node version * revert: node version bump * WIP: CD create beta release pr * fix: CD create beta release pr * fix: show future cd workflow names * dep: bump github action versions * turn on stable release pr creation --------- Co-authored-by: shrunyan --- .github/workflows/cd-beta.yaml | 181 +++++++++++++--------------- .github/workflows/cd-dev-stage.yaml | 62 +++------- .github/workflows/cd-stable.yaml | 71 +++++------ package-lock.json | 12 +- package.json | 1 - 5 files changed, 133 insertions(+), 194 deletions(-) diff --git a/.github/workflows/cd-beta.yaml b/.github/workflows/cd-beta.yaml index 814d158f15..78957899f4 100644 --- a/.github/workflows/cd-beta.yaml +++ b/.github/workflows/cd-beta.yaml @@ -1,100 +1,89 @@ -# name: cd-beta +name: cd-beta -# on: -# # Uncomment to work on CD in development mode. -# # pull_request: -# # branches: [ master ] -# push: -# branches: -# - beta +on: + push: + branches: + - beta -# jobs: -# deploy_to_beta: -# runs-on: ubuntu-latest -# env: -# ENV: "beta" +jobs: + # deploy_beta: + # runs-on: ubuntu-latest + # env: + # ENV: "prod" -# steps: -# # This Clean step simply checks if there's already a workflow running from the last -# # commit and cancels it if there is. This helps us save on cloud cost in the long run. -# # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. -# - name: Clean -# uses: rokroskar/workflow-run-cleanup-action@v0.2.2 -# env: -# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" -# if: "github.ref != 'refs/heads/master'" -# - name: Checkout Repo -# uses: actions/checkout@v2 -# - name: Auth with Gcloud -# uses: google-github-actions/auth@v0 -# with: -# credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} -# - name: Set up Gcloud SDK -# uses: google-github-actions/setup-gcloud@v0 -# with: -# project_id: zesty-dev -# - name: Set up Node -# uses: actions/setup-node@v2 -# with: -# node-version: "16.5.0" -# cache: "npm" -# cache-dependency-path: package-lock.json -# - name: Install Dependencies -# run: npm install -# - name: Build -# run: npm run build:dev -# env: -# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} -# - name: Deploy to Dev -# run: gcloud app deploy app.yaml --quiet --project zesty-dev -# - name: Post Successful Dev Deploy Notification To Slack -# uses: rtCamp/action-slack-notify@v2 -# env: -# SLACK_CHANNEL: devops -# SLACK_COLOR: ${{ job.status }} -# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png -# SLACK_MESSAGE: | -# Use :eyes: to signal you have seen this message. -# Use :white_check_mark: to signal you have successfully manually tested the deployed changes. -# Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. -# SLACK_TITLE: Successfully Deployed manager-ui to Dev -# SLACK_USERNAME: Deploy Bot -# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} -# cancel_workflow_if_beta_deploy_failed: -# runs-on: ubuntu-latest -# if: ${{ failure() }} -# needs: -# - deploy_to_beta -# steps: -# - name: Post Failed Beta Deploy Notification To Slack -# uses: rtCamp/action-slack-notify@v2 -# env: -# SLACK_CHANNEL: devops -# SLACK_COLOR: "#FF0000" -# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png -# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to beta." -# SLACK_TITLE: Beta Deployment Failed for manager-ui -# SLACK_USERNAME: Deploy Bot -# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} -# - name: Cancel current workflow run -# uses: actions/github-script@v4 -# with: -# script: | -# github.actions.cancelWorkflowRun({ -# owner: context.repo.owner, -# repo: context.repo.repo, -# run_id: context.runId -# }) -# create_stable_pr: -# runs-on: ubuntu-latest -# needs: -# - deploy_to_beta + # steps: + # # This Clean step simply checks if there's already a workflow running from the last + # # commit and cancels it if there is. This helps us save on cloud cost in the long run. + # # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. + # - name: Clean + # uses: rokroskar/workflow-run-cleanup-action@v0.2.2 + # env: + # GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # if: "github.ref != 'refs/heads/master'" + # - name: Checkout Repo + # uses: actions/checkout@v2 + # - name: Auth with Gcloud + # uses: google-github-actions/auth@v0 + # with: + # credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} + # - name: Set up Gcloud SDK + # uses: google-github-actions/setup-gcloud@v0 + # with: + # project_id: zesty-prod + # - name: Set up Node + # uses: actions/setup-node@v2 + # with: + # node-version: "16.5.0" + # cache: "npm" + # cache-dependency-path: package-lock.json + # - name: Install Dependencies + # run: npm install + # - name: Build + # run: npm run build:prod + # env: + # SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + # - name: Deploy to Beta + # run: gcloud app deploy app.yaml --quiet --no-promote --version beta --project zesty-prod -# steps: -# - name: Create Stable Release PR -# uses: peter-evans/create-pull-request@v6 -# with: -# branch: beta -# base: master -# title: master -# # labels: + # failed_deploy_notification_to_slack: + # runs-on: ubuntu-latest + # if: ${{ failure() }} + # needs: deploy_beta + # steps: + # - name: Failed Deploy Notification To Slack + # uses: rtCamp/action-slack-notify@v2 + # env: + # SLACK_CHANNEL: code-deploy + # SLACK_COLOR: "#FF0000" + # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png + # SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." + # SLACK_TITLE: FAILED Beta Deployment for manager-ui + # SLACK_USERNAME: Deploy Bot + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + # success_deploy_notification_to_slack: + # runs-on: ubuntu-latest + # if: ${{ success() }} + # needs: [deploy_beta] + # steps: + # - name: Success Deploy Notification To Slack + # uses: rtCamp/action-slack-notify@v2 + # env: + # SLACK_CHANNEL: code-deploy + # SLACK_COLOR: "#FF0000" + # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png + # SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." + # SLACK_TITLE: Beta Deployment for manager-ui + # SLACK_USERNAME: Deploy Bot + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + create_stable_pr: + runs-on: ubuntu-latest + # needs: [deploy_beta] + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Create Stable Release PR + run: gh pr create -B stable -H beta --title 'Stable Release' --body 'Created by Github action' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cd-dev-stage.yaml b/.github/workflows/cd-dev-stage.yaml index 1aa1f4a8d2..ce49589f21 100644 --- a/.github/workflows/cd-dev-stage.yaml +++ b/.github/workflows/cd-dev-stage.yaml @@ -8,7 +8,7 @@ on: branches: - dev jobs: - deploy_to_dev: + deploy_dev: runs-on: ubuntu-latest env: ENV: "dev" @@ -25,11 +25,11 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 - name: Auth with Gcloud - uses: google-github-actions/auth@v0 + uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} - name: Set up Gcloud SDK - uses: google-github-actions/setup-gcloud@v0 + uses: google-github-actions/setup-gcloud@v2 with: project_id: zesty-dev - name: Set up Node @@ -46,20 +46,8 @@ jobs: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Deploy to Dev run: gcloud app deploy app.yaml --quiet --project zesty-dev - - name: Post Successful Dev Deploy Notification To Slack - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: devops - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - SLACK_MESSAGE: | - Use :eyes: to signal you have seen this message. - Use :white_check_mark: to signal you have successfully manually tested the deployed changes. - Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. - SLACK_TITLE: Successfully Deployed manager-ui to Dev - SLACK_USERNAME: Deploy Bot - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - deploy_to_stage: + + deploy_stage: runs-on: ubuntu-latest env: ENV: "stage" @@ -95,26 +83,13 @@ jobs: run: npm run build:stage env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: Deploy to Staging + - name: Deploy to Stage run: gcloud app deploy app.yaml --quiet --project zesty-stage - - name: Post Successful Stage Deploy Notification To Slack - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: devops - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - SLACK_MESSAGE: | - Use :eyes: to signal you have seen this message. - Use :white_check_mark: to signal you have successfully manually tested the deployed changes. - Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. - SLACK_TITLE: Successfully Deployed manager-ui to Stage - SLACK_USERNAME: Deploy Bot - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} failed_deploy_notification_to_slack: runs-on: ubuntu-latest if: ${{ failure() }} - needs: [deploy_to_dev, deploy_to_stage] + needs: [deploy_dev, deploy_stage] steps: - name: Failed Deploy Notification To Slack uses: rtCamp/action-slack-notify@v2 @@ -123,20 +98,20 @@ jobs: SLACK_COLOR: "#FF0000" SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." - SLACK_TITLE: Deployment Failed for manager-ui + SLACK_TITLE: FAILED Dev/Stage Deployment for manager-ui SLACK_USERNAME: Deploy Bot SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} success_deploy_notification_to_slack: runs-on: ubuntu-latest if: ${{ success() }} - needs: [deploy_to_stage] + needs: [deploy_stage] steps: - name: Success Deploy Notification To Slack uses: rtCamp/action-slack-notify@v2 env: SLACK_CHANNEL: code-deploy - SLACK_COLOR: "#FF0000" + SLACK_COLOR: "#36a64f" SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." SLACK_TITLE: Stage Deployment for manager-ui @@ -145,16 +120,11 @@ jobs: create_beta_pr: runs-on: ubuntu-latest - needs: - - deploy_to_dev - - deploy_to_stage - + needs: [deploy_dev, deploy_stage] steps: - - uses: actions/checkout@v4 + - name: Checkout Repo + uses: actions/checkout@v2 - name: Create Beta Release PR - uses: peter-evans/create-pull-request@v6 - with: - branch: beta - # base: dev - title: beta - # labels: + run: gh pr create -B beta -H dev --title 'Beta Release' --body 'Created by Github action' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cd-stable.yaml b/.github/workflows/cd-stable.yaml index 0993a50d8e..b4abe2e85f 100644 --- a/.github/workflows/cd-stable.yaml +++ b/.github/workflows/cd-stable.yaml @@ -1,18 +1,15 @@ -# name: cd-stable +name: cd-stable -# on: -# # Uncomment to work on CD in development mode. -# # pull_request: -# # branches: [ master ] -# push: -# branches: -# - master +on: + push: + branches: + - stable -# jobs: -# deploy_to_stable: +jobs: +# deploy_stable: # runs-on: ubuntu-latest # env: -# ENV: "stable" +# ENV: "prod" # steps: # # This Clean step simply checks if there's already a workflow running from the last @@ -32,7 +29,7 @@ # - name: Set up Gcloud SDK # uses: google-github-actions/setup-gcloud@v0 # with: -# project_id: zesty-dev +# project_id: zesty-prod # - name: Set up Node # uses: actions/setup-node@v2 # with: @@ -42,46 +39,40 @@ # - name: Install Dependencies # run: npm install # - name: Build -# run: npm run build:dev +# run: npm run build:prod # env: # SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} -# - name: Deploy to Dev -# run: gcloud app deploy app.yaml --quiet --project zesty-dev -# - name: Post Successful Dev Deploy Notification To Slack +# - name: Deploy Stable +# run: gcloud app deploy app.yaml --quiet --project zesty-prod + +# failed_deploy_notification_to_slack: +# runs-on: ubuntu-latest +# if: ${{ failure() }} +# needs: deploy_stable +# steps: +# - name: Failed Deploy Notification To Slack # uses: rtCamp/action-slack-notify@v2 # env: -# SLACK_CHANNEL: devops -# SLACK_COLOR: ${{ job.status }} +# SLACK_CHANNEL: code-deploy +# SLACK_COLOR: "#FF0000" # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png -# SLACK_MESSAGE: | -# Use :eyes: to signal you have seen this message. -# Use :white_check_mark: to signal you have successfully manually tested the deployed changes. -# Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. -# SLACK_TITLE: Successfully Deployed manager-ui to Dev +# SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." +# SLACK_TITLE: FAILED Stable Deployment for manager-ui # SLACK_USERNAME: Deploy Bot # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} -# cancel_workflow_if_beta_deploy_failed: + +# success_deploy_notification_to_slack: # runs-on: ubuntu-latest -# if: ${{ failure() }} -# needs: -# - deploy_to_stable +# if: ${{ success() }} +# needs: [deploy_stable] # steps: -# - name: Post Failed Dev Deploy Notification To Slack +# - name: Success Deploy Notification To Slack # uses: rtCamp/action-slack-notify@v2 # env: -# SLACK_CHANNEL: devops +# SLACK_CHANNEL: code-deploy # SLACK_COLOR: "#FF0000" # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png -# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to dev." -# SLACK_TITLE: Dev Deployment Failed for manager-ui +# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." +# SLACK_TITLE: Stable Deployment for manager-ui # SLACK_USERNAME: Deploy Bot # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} -# - name: Cancel current workflow run -# uses: actions/github-script@v4 -# with: -# script: | -# github.actions.cancelWorkflowRun({ -# owner: context.repo.owner, -# repo: context.repo.repo, -# run_id: context.runId -# }) diff --git a/package-lock.json b/package-lock.json index a149c759a2..9e2289d1e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,10 +5,10 @@ "requires": true, "packages": { "": { + "name": "manager-ui", "version": "1.0.1", "license": "Commons Clause License Condition v1.0", "dependencies": { - "-": "^0.0.1", "@aeaton/react-prosemirror": "^0.21.1", "@aeaton/react-prosemirror-config-default": "^0.11.0", "@babel/runtime": "^7.10.4", @@ -126,11 +126,6 @@ "webpack-dev-server": "^3.11.2" } }, - "node_modules/-": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/-/-/--0.0.1.tgz", - "integrity": "sha512-3HfneK3DGAm05fpyj20sT3apkNcvPpCuccOThOPdzz8sY7GgQGe0l93XH9bt+YzibcTIgUAIMoyVJI740RtgyQ==" - }, "node_modules/@aeaton/prosemirror-footnotes": { "version": "0.1.0", "license": "MIT", @@ -15730,11 +15725,6 @@ } }, "dependencies": { - "-": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/-/-/--0.0.1.tgz", - "integrity": "sha512-3HfneK3DGAm05fpyj20sT3apkNcvPpCuccOThOPdzz8sY7GgQGe0l93XH9bt+YzibcTIgUAIMoyVJI740RtgyQ==" - }, "@aeaton/prosemirror-footnotes": { "version": "0.1.0", "requires": { diff --git a/package.json b/package.json index 5c85f668d0..937c2be707 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "test:open": "./node_modules/.bin/cypress open" }, "dependencies": { - "-": "^0.0.1", "@aeaton/react-prosemirror": "^0.21.1", "@aeaton/react-prosemirror-config-default": "^0.11.0", "@babel/runtime": "^7.10.4",