Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit db1a4d0

Browse files
author
Noah Hanjun Lee
authored
Add production deployment pipeline (#120)
* Add production environment * Add deploy pipeline
1 parent c868f24 commit db1a4d0

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/deploy-to-cloud.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,60 @@ jobs:
7777
description: Failed to deploy.
7878
state: "failure"
7979
token: "${{ github.token }}"
80+
81+
deploy-production:
82+
runs-on: ubuntu-latest
83+
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment
84+
if: ${{ github.event.deployment.environment == 'production' }}
85+
steps:
86+
-
87+
name: Checkout
88+
uses: actions/checkout@v2
89+
-
90+
name: Create values.yaml
91+
uses: finnp/create-file-action@master
92+
env:
93+
FILE_NAME: "./.github/values.yaml"
94+
FILE_BASE64: "cmVwbGljYUNvdW50OiAyCgppbmdyZXNzOgogIGVuYWJsZWQ6IHRydWUKICBhbm5vdGF0aW9uczoKICAgIGt1YmVybmV0ZXMuaW8vaW5ncmVzcy5jbGFzczogbmdpbngKICAgIGNlcnQtbWFuYWdlci5pby9jbHVzdGVyLWlzc3VlcjogImxldHNlbmNyeXB0LXByb2QiCiAgaG9zdHM6CiAgICAtIGhvc3Q6IGNsb3VkLmdpdHBsb3kuaW8KICAgICAgcGF0aHM6CiAgICAgICAgLSAvCiAgdGxzOgogICAtIHNlY3JldE5hbWU6IGdpdHBsb3ktcHJvZC10bHMKICAgICBob3N0czoKICAgICAgIC0gY2xvdWQuZ2l0cGxveS5pbwoKcmVzb3VyY2VzOgogIHJlcXVlc3RzOgogICAgY3B1OiAxMDBtCiAgICBtZW1vcnk6IDI1Nk1pCgplbnY6CiAgR0lUUExPWV9ERUJVR19NT0RFOiAidHJ1ZSIKICBHSVRQTE9ZX1NFUlZFUl9IT1NUOiAiY2xvdWQuZ2l0cGxveS5pbyIKICBHSVRQTE9ZX1NFUlZFUl9QUk9UTzogaHR0cHMKICBHSVRQTE9ZX0FETUlOX1VTRVJTOiAiaGFuanVubGVlIgogIEdJVFBMT1lfR0lUSFVCX1NDT1BFUzogInB1YmxpY19yZXBvLHJlYWQ6dXNlcixyZWFkOm9yZyIKICBHSVRQTE9ZX1NUT1JFX0RSSVZFUjogIm15c3FsIgoKZXh0cmFTZWNyZXROYW1lc0ZvckVudkZyb206CiAgLSBnaXRwbG95LXByb2Qtc2VjcmV0Cg=="
95+
-
96+
name: Start to deploy
97+
uses: chrnorm/deployment-status@releases/v1
98+
with:
99+
deployment_id: ${{ github.event.deployment.id }}
100+
description: Start to deploy to the Kubernetes
101+
state: "in_progress"
102+
token: "${{ github.token }}"
103+
-
104+
name: Deploy
105+
uses: WyriHaximus/github-action-helm3@v2
106+
with:
107+
# Upgrade to the version.
108+
exec: >
109+
helm repo add gitployio https://gitploy-io.github.io/helm-chart/;
110+
helm upgrade gitploy-prod gitployio/gitploy
111+
--install
112+
--atomic
113+
--namespace=gitploy
114+
-f .github/values.yaml
115+
--set=image.tag=${GITHUB_REF#refs/tags/v}
116+
--description="Upgrade to ${GITHUB_REF#refs/tags/}"
117+
kubeconfig: '${{ secrets.KUBECONFIG }}'
118+
-
119+
name: Deploy successfully
120+
if: success()
121+
uses: chrnorm/deployment-status@releases/v1
122+
with:
123+
deployment_id: ${{ github.event.deployment.id }}
124+
description: Finish to deploy successfully.
125+
state: "success"
126+
token: "${{ github.token }}"
127+
-
128+
name: Deploy failed
129+
if: failure()
130+
uses: chrnorm/deployment-status@releases/v1
131+
with:
132+
deployment_id: ${{ github.event.deployment.id }}
133+
description: Failed to deploy.
134+
state: "failure"
135+
token: "${{ github.token }}"
80136

deploy.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ envs:
1313
- "go-test"
1414
- "react-test"
1515
- "publish-image"
16+
17+
- name: production
18+
task: ${GITPLOY_DEPLOY_TASK:=rollback}:kubernetes
19+
auto_merge: false
20+
required_contexts:
21+
- "go-test"
22+
- "react-test"
23+
- "publish-image"
24+
production_environment: true
1625
approval:
1726
enabled: true
1827
required_count: 0

0 commit comments

Comments
 (0)