Skip to content

Commit

Permalink
Stable Release (#2603)
Browse files Browse the repository at this point in the history
* fix: split cd by environment

* improve slack alerts for cd

* testing new branching strategy CD (#2598)

* 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 <shrunyan@gmail.com>

---------

Co-authored-by: shrunyan <shrunyan@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and shrunyan authored Mar 20, 2024
1 parent 0cbe5ae commit 5152617
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 180 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/cd-beta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: cd-beta

on:
push:
branches:
- 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-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

# 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 }}
130 changes: 130 additions & 0 deletions .github/workflows/cd-dev-stage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: cd-dev-stage

on:
# Uncomment to work on CD in development mode.
# pull_request:
# branches: [ master ]
push:
branches:
- dev
jobs:
deploy_dev:
runs-on: ubuntu-latest
env:
ENV: "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@v2
with:
credentials_json: ${{ secrets.GCP_DEV_SA_KEY }}
- name: Set up Gcloud SDK
uses: google-github-actions/setup-gcloud@v2
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

deploy_stage:
runs-on: ubuntu-latest
env:
ENV: "stage"

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 Stage
run: gcloud app deploy app.yaml --quiet --project zesty-stage

failed_deploy_notification_to_slack:
runs-on: ubuntu-latest
if: ${{ failure() }}
needs: [deploy_dev, deploy_stage]
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 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_stage]
steps:
- name: Success Deploy Notification To Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: code-deploy
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
SLACK_USERNAME: Deploy Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

create_beta_pr:
runs-on: ubuntu-latest
needs: [deploy_dev, deploy_stage]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Create Beta Release PR
run: gh pr create -B beta -H dev --title 'Beta Release' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78 changes: 78 additions & 0 deletions .github/workflows/cd-stable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: cd-stable

on:
push:
branches:
- stable

jobs:
# deploy_stable:
# 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-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 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: 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 Stable 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_stable]
# 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: Stable Deployment for manager-ui
# SLACK_USERNAME: Deploy Bot
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Loading

0 comments on commit 5152617

Please sign in to comment.