-
Notifications
You must be signed in to change notification settings - Fork 10
80 lines (62 loc) · 2.13 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
77
78
79
80
name: CD
on: push
env:
CI: true
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- uses: satackey/[email protected]
continue-on-error: true
- name: Run the tests
run: rake test
deploy:
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: satackey/[email protected]
continue-on-error: true
- name: Set environment from cloudtruth
uses: cloudtruth/configure-action@v2
with:
apikey: "${{ secrets.CLOUDTRUTH_API_KEY }}"
project: "deploy"
environment: "production"
- name: Install Atmos
run: sudo gem install --no-document simplygenius-atmos
- name: Setup Atmos
run: |
mkdir -p config
echo -e "${ATMOS_YML}" > config/atmos.yml
- name: Build the Docker image
run: |
rake build_release
- name: Push the Docker image
run: |
tag=${GITHUB_REF##*/v}
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
TAGS="$tag latest" rake docker_push
- name: Package helm chart
run: |
export HELM_REPO_URL="${PACKAGES_URL}/${PACKAGES_HELM_PATH}"
rake helm_package
- name: Deploy helm chart to S3
run: |
atmos -e production auth_exec aws s3 sync tmp/packaged-chart/ s3://${PACKAGES_BUCKET_NAME}/${PACKAGES_HELM_PATH}/
assets=""
for asset in tmp/packaged-chart/*; do
asset=${asset##*/}
asset="/${PACKAGES_HELM_PATH}/${asset}"
assets="${assets} ${asset}"
done
atmos -e production auth_exec aws cloudfront create-invalidation --distribution-id ${PACKAGES_DISTRIBUTION_ID} --paths ${assets}