-
Notifications
You must be signed in to change notification settings - Fork 4
76 lines (75 loc) · 2.83 KB
/
cd.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
name: CD
on:
push:
branches:
- main
- feat-deployment
- feat-k8s
jobs:
duplicate_guard:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: "never"
skip_after_successful_duplicate: "true"
paths_ignore: '["**/README.md", "**/docs/**"]'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
# test:
# needs: duplicate_guard
# if: ${{ needs.duplicate_guard.outputs.should_skip != 'true' }}
# runs-on: ubuntu-latest
# steps:
# - name: checkout
# uses: actions/checkout@v2
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# - name: Run tests
# run: |
# echo -e "$SECRETS_BASE64_ENCODED" | base64 -d | sudo tee ./backend/secrets.json > /dev/null
# docker-compose build && docker-compose up -d && sleep 120s && cd ./backend/scripts && ./run-test.sh ; docker-compose down
# env:
# SECRETS_BASE64_ENCODED: ${{ secrets.SECRETS_BASE64_ENCODED }}
docker-build:
# needs: test
needs: duplicate_guard
if: ${{ needs.duplicate_guard.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
run: |
docker login -u AWS -p $(aws ecr-public get-login-password --region us-east-1) public.ecr.aws/w1d0u6d8
- name: Build and push images & upload to ECR
id: build_images
run: |
./build-images.sh
./push-images.sh
- name: Config kubectl & Trigger deployments & Do rolling update for existing deployments
run: |
echo -e "$CONFIG_YAML_BASE64" | base64 -d - | tee ~/k3s.yaml > /dev/null
export KUBECONFIG=$HOME/k3s.yaml:$KUBECONFIG
kubectl config use-context deepmush-k3s
./up-pods.sh
./rolling-release.sh
env:
CONFIG_YAML_BASE64: ${{ secrets.CONFIG_YAML_BASE64 }}