-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (51 loc) · 1.7 KB
/
deployment.yaml
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
name: Deployment Workflow
on:
workflow_call:
inputs:
# Mandatory inputs
githubRef:
required: true
type: string
gitSha:
required: true
type: string
secrets:
AWS_ACCOUNT_ID:
required: true
GH_AWS_ACCESS_KEY_ID:
required: true
GH_AWS_SECRET_ACCESS_KEY:
required: true
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ inputs.githubRef }} == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- id: synth
name: Synth cdk8s manifests
run: |-
cd k8s
yarn install --frozen-lockfile
# Get repo name (by removing owner/organization)
export RELEASE_NAME=${REPOSITORY#*/}
# Export RELEASE_NAME as an output
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_OUTPUT
yarn build
env:
GIT_SHA: ${{ inputs.gitSha }}
REPOSITORY: ${{ github.repository }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
- name: Deploy
if: steps.synth.outcome == 'success'
run: |-
aws eks --region us-east-1 update-kubeconfig --name production --role-arn arn:aws:iam::${AWS_ACCOUNT_ID}:role/kubectl
# Get repo name from synth step
RELEASE_NAME=${{ steps.synth.outputs.RELEASE_NAME }}
# Deploy
kubectl apply -f k8s/dist/ -l app.kubernetes.io/component=certificate
kubectl apply -f k8s/dist/ --prune -l app.kubernetes.io/part-of=$RELEASE_NAME
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.GH_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }}