Skip to content

Commit d49a002

Browse files
committed
fix: cd flow to work with new npm command names
1 parent deef89b commit d49a002

File tree

1 file changed

+110
-110
lines changed

1 file changed

+110
-110
lines changed

.github/workflows/cd.yaml

+110-110
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
# pull_request:
66
# branches: [ master ]
77
push:
8-
branches:
9-
- master
8+
branches:
9+
- master
1010

1111
jobs:
1212
deploy_to_dev:
@@ -15,138 +15,138 @@ jobs:
1515
ENV: "dev"
1616

1717
steps:
18-
# This Clean step simply checks if there's already a workflow running from the last
19-
# commit and cancels it if there is. This helps us save on cloud cost in the long run.
20-
# See https://github.com/rokroskar/workflow-run-cleanup-action for more information.
21-
- name: Clean
22-
uses: rokroskar/[email protected]
23-
env:
24-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
25-
if: "github.ref != 'refs/heads/master'"
26-
- name: Checkout Repo
27-
uses: actions/checkout@v2
28-
- name: Auth with Gcloud
29-
uses: google-github-actions/auth@v0
30-
with:
31-
credentials_json: ${{ secrets.GCP_DEV_SA_KEY }}
32-
- name: Set up Gcloud SDK
33-
uses: google-github-actions/setup-gcloud@v0
34-
with:
35-
project_id: zesty-dev
36-
- name: Set up Node
37-
uses: actions/setup-node@v2
38-
with:
39-
node-version: "16.5.0"
40-
cache: "npm"
41-
cache-dependency-path: package-lock.json
42-
- name: Install Dependencies
43-
run: npm install
44-
- name: Build
45-
run: npm run build-dev
46-
- name: Deploy to Dev
47-
run: gcloud app deploy app.yaml --quiet --project zesty-dev
48-
- name: Post Successful Dev Deploy Notification To Slack
49-
uses: rtCamp/action-slack-notify@v2
50-
env:
51-
SLACK_CHANNEL: devops
52-
SLACK_COLOR: ${{ job.status }}
53-
SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
54-
SLACK_MESSAGE: |
55-
Use :eyes: to signal you have seen this message.
56-
Use :white_check_mark: to signal you have successfully manually tested the deployed changes.
57-
Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps.
58-
SLACK_TITLE: Successfully Deployed manager-ui to Dev
59-
SLACK_USERNAME: Deploy Bot
60-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
18+
# This Clean step simply checks if there's already a workflow running from the last
19+
# commit and cancels it if there is. This helps us save on cloud cost in the long run.
20+
# See https://github.com/rokroskar/workflow-run-cleanup-action for more information.
21+
- name: Clean
22+
uses: rokroskar/[email protected]
23+
env:
24+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
25+
if: "github.ref != 'refs/heads/master'"
26+
- name: Checkout Repo
27+
uses: actions/checkout@v2
28+
- name: Auth with Gcloud
29+
uses: google-github-actions/auth@v0
30+
with:
31+
credentials_json: ${{ secrets.GCP_DEV_SA_KEY }}
32+
- name: Set up Gcloud SDK
33+
uses: google-github-actions/setup-gcloud@v0
34+
with:
35+
project_id: zesty-dev
36+
- name: Set up Node
37+
uses: actions/setup-node@v2
38+
with:
39+
node-version: "16.5.0"
40+
cache: "npm"
41+
cache-dependency-path: package-lock.json
42+
- name: Install Dependencies
43+
run: npm install
44+
- name: Build
45+
run: npm run build:dev
46+
- name: Deploy to Dev
47+
run: gcloud app deploy app.yaml --quiet --project zesty-dev
48+
- name: Post Successful Dev Deploy Notification To Slack
49+
uses: rtCamp/action-slack-notify@v2
50+
env:
51+
SLACK_CHANNEL: devops
52+
SLACK_COLOR: ${{ job.status }}
53+
SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
54+
SLACK_MESSAGE: |
55+
Use :eyes: to signal you have seen this message.
56+
Use :white_check_mark: to signal you have successfully manually tested the deployed changes.
57+
Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps.
58+
SLACK_TITLE: Successfully Deployed manager-ui to Dev
59+
SLACK_USERNAME: Deploy Bot
60+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
6161
cancel_workflow_if_dev_deploy_failed:
62-
runs-on: ubuntu-latest
63-
if: ${{ failure() }}
64-
needs:
65-
- deploy_to_dev
66-
steps:
62+
runs-on: ubuntu-latest
63+
if: ${{ failure() }}
64+
needs:
65+
- deploy_to_dev
66+
steps:
6767
- name: Post Failed Dev Deploy Notification To Slack
6868
uses: rtCamp/action-slack-notify@v2
6969
env:
7070
SLACK_CHANNEL: devops
71-
SLACK_COLOR: '#FF0000'
71+
SLACK_COLOR: "#FF0000"
7272
SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
73-
SLACK_MESSAGE: 'PR merge by ${{ github.actor }} has failed to deploy to dev.'
73+
SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to dev."
7474
SLACK_TITLE: Dev Deployment Failed for manager-ui
7575
SLACK_USERNAME: Deploy Bot
7676
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
7777
- name: Cancel current workflow run
7878
uses: actions/github-script@v4
7979
with:
80-
script: |
81-
github.actions.cancelWorkflowRun({
82-
owner: context.repo.owner,
83-
repo: context.repo.repo,
84-
run_id: context.runId
85-
})
80+
script: |
81+
github.actions.cancelWorkflowRun({
82+
owner: context.repo.owner,
83+
repo: context.repo.repo,
84+
run_id: context.runId
85+
})
8686
deploy_to_stage:
8787
runs-on: ubuntu-latest
8888
env:
8989
ENV: "stage"
9090
needs:
91-
- deploy_to_dev
91+
- deploy_to_dev
9292

9393
steps:
94-
# This Clean step simply checks if there's already a workflow running from the last
95-
# commit and cancels it if there is. This helps us save on cloud cost in the long run.
96-
# See https://github.com/rokroskar/workflow-run-cleanup-action for more information.
97-
- name: Clean
98-
uses: rokroskar/[email protected]
99-
env:
100-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
101-
if: "github.ref != 'refs/heads/master'"
102-
- name: Checkout Repo
103-
uses: actions/checkout@v2
104-
- name: Auth with Gcloud
105-
uses: google-github-actions/auth@v0
106-
with:
107-
credentials_json: ${{ secrets.GCP_SA_KEY }}
108-
- name: Set up Gcloud SDK
109-
uses: google-github-actions/setup-gcloud@v0
110-
with:
111-
project_id: zesty-stage
112-
- name: Set up Node
113-
uses: actions/setup-node@v2
114-
with:
115-
node-version: "16.5.0"
116-
cache: "npm"
117-
cache-dependency-path: package-lock.json
118-
- name: Install Dependencies
119-
run: npm install
120-
- name: Build
121-
run: npm run build-stage
122-
- name: Deploy to Staging
123-
run: gcloud app deploy app.yaml --quiet --project zesty-stage
124-
- name: Post Successful Stage Deploy Notification To Slack
125-
uses: rtCamp/action-slack-notify@v2
126-
env:
127-
SLACK_CHANNEL: devops
128-
SLACK_COLOR: ${{ job.status }}
129-
SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
130-
SLACK_MESSAGE: |
131-
Use :eyes: to signal you have seen this message.
132-
Use :white_check_mark: to signal you have successfully manually tested the deployed changes.
133-
Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps.
134-
SLACK_TITLE: Successfully Deployed manager-ui to Stage
135-
SLACK_USERNAME: Deploy Bot
136-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
94+
# This Clean step simply checks if there's already a workflow running from the last
95+
# commit and cancels it if there is. This helps us save on cloud cost in the long run.
96+
# See https://github.com/rokroskar/workflow-run-cleanup-action for more information.
97+
- name: Clean
98+
uses: rokroskar/[email protected]
99+
env:
100+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
101+
if: "github.ref != 'refs/heads/master'"
102+
- name: Checkout Repo
103+
uses: actions/checkout@v2
104+
- name: Auth with Gcloud
105+
uses: google-github-actions/auth@v0
106+
with:
107+
credentials_json: ${{ secrets.GCP_SA_KEY }}
108+
- name: Set up Gcloud SDK
109+
uses: google-github-actions/setup-gcloud@v0
110+
with:
111+
project_id: zesty-stage
112+
- name: Set up Node
113+
uses: actions/setup-node@v2
114+
with:
115+
node-version: "16.5.0"
116+
cache: "npm"
117+
cache-dependency-path: package-lock.json
118+
- name: Install Dependencies
119+
run: npm install
120+
- name: Build
121+
run: npm run build:stage
122+
- name: Deploy to Staging
123+
run: gcloud app deploy app.yaml --quiet --project zesty-stage
124+
- name: Post Successful Stage Deploy Notification To Slack
125+
uses: rtCamp/action-slack-notify@v2
126+
env:
127+
SLACK_CHANNEL: devops
128+
SLACK_COLOR: ${{ job.status }}
129+
SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
130+
SLACK_MESSAGE: |
131+
Use :eyes: to signal you have seen this message.
132+
Use :white_check_mark: to signal you have successfully manually tested the deployed changes.
133+
Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps.
134+
SLACK_TITLE: Successfully Deployed manager-ui to Stage
135+
SLACK_USERNAME: Deploy Bot
136+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
137137
post_failed_stage_deploy_notification_to_slack:
138-
runs-on: ubuntu-latest
139-
if: ${{ failure() }}
140-
needs:
141-
- deploy_to_stage
142-
steps:
138+
runs-on: ubuntu-latest
139+
if: ${{ failure() }}
140+
needs:
141+
- deploy_to_stage
142+
steps:
143143
- name: Post Failed Staging Deploy Notification To Slack
144144
uses: rtCamp/action-slack-notify@v2
145145
env:
146146
SLACK_CHANNEL: devops
147-
SLACK_COLOR: '#FF0000'
147+
SLACK_COLOR: "#FF0000"
148148
SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
149-
SLACK_MESSAGE: 'PR merge by ${{ github.actor }} has failed to deploy to staging.'
149+
SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to staging."
150150
SLACK_TITLE: Staging Deployment Failed for manager-ui
151151
SLACK_USERNAME: Deploy Bot
152-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
152+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)