This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
116 lines (107 loc) · 3.41 KB
/
deploy-production.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Deploy suite (Production)
on:
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
env:
ECR_REGISTRY: 598984531759.dkr.ecr.us-east-2.amazonaws.com
IMG_PREFIX: base-cms-services
jobs:
version:
runs-on: ubuntu-latest
steps:
- id: tag_version
run: |
REF=$(echo $GITHUB_REF | cut -d / -f 3)
[[ "$GITHUB_REF" =~ ^refs/tags.*$ ]] && VERSION="$REF" || VERSION="${REF}-${GITHUB_SHA::7}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.tag_version.outputs.version }}
notify-start:
needs: [version]
uses: parameter1/actions/.github/workflows/notify-start.yml@main
secrets: inherit
with:
version: ${{ needs.version.outputs.version }}
post-deploy-failure:
if: failure()
needs: [notify-start, build, deploy-2]
uses: parameter1/actions/.github/workflows/notify-fail.yml@main
secrets: inherit
with:
slack-thread: ${{ needs.notify-start.outputs.slack-thread }}
post-deploy-complete:
if: success()
needs: [notify-start, build, deploy-2]
uses: parameter1/actions/.github/workflows/notify-complete.yml@main
secrets: inherit
with:
slack-thread: ${{ needs.notify-start.outputs.slack-thread }}
build:
needs: [version]
runs-on: ubuntu-latest
strategy:
matrix:
service:
- google-data-api
- graphql-server
- hooks
- oembed
- omail-link-processor
- rss
- sitemaps
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v1
name: Login to ECR
with:
registry: ${{ env.ECR_REGISTRY }}
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
file: services/${{ matrix.service }}/Dockerfile
push: true
build-args: |
SERVICE=${{ matrix.service }}
tags: ${{ env.ECR_REGISTRY }}/${{ env.IMG_PREFIX }}:${{ matrix.service }}-${{ needs.version.outputs.version }}
deploy-1:
needs: [version, build]
runs-on: ubuntu-latest
strategy:
matrix:
service:
- google-data-api
- oembed
- rss
- sitemaps
steps:
- name: Deploy to Kubernetes
run: |
npx @parameter1/rancher2cli dl \
--wait basecms-service ${{ matrix.service }} \
${{ env.ECR_REGISTRY }}/${{ env.IMG_PREFIX }}:${{ matrix.service }}-${{ needs.version.outputs.version }}
env:
RANCHER_CLUSTERID: ${{ secrets.RANCHER_CLUSTERID_BASECMS }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
RANCHER_URL: ${{ secrets.RANCHER_URL }}
deploy-2:
needs: [version, build, deploy-1]
runs-on: ubuntu-latest
strategy:
matrix:
service:
- graphql-server
- hooks
- omail-link-processor
steps:
- name: Deploy to Kubernetes
run: |
npx @parameter1/rancher2cli dl \
--wait basecms-service ${{ matrix.service }} \
${{ env.ECR_REGISTRY }}/${{ env.IMG_PREFIX }}:${{ matrix.service }}-${{ needs.version.outputs.version }}
env:
RANCHER_CLUSTERID: ${{ secrets.RANCHER_CLUSTERID_BASECMS }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
RANCHER_URL: ${{ secrets.RANCHER_URL }}