-
Notifications
You must be signed in to change notification settings - Fork 26
107 lines (94 loc) · 3.2 KB
/
release.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
name: Release
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v2.1.3
jobs:
update-database:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v1
env:
NEO4J_HOST: ${{ secrets.PROD_NEO4J_HOST }}
NEO4J_USERNAME: ${{ secrets.PROD_NEO4J_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.PROD_NEO4J_PASSWORD }}
with:
node-version: "16"
- name: Install NPM Dependencies
run: npm install
# Sync content to production DB
- name: Sync content to Prod Instance
env:
NEO4J_HOST: ${{ secrets.PROD_NEO4J_HOST }}
NEO4J_USERNAME: ${{ secrets.PROD_NEO4J_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.PROD_NEO4J_PASSWORD }}
run: npm run sync:content
# Test the database
- name: Test Database
env:
NEO4J_HOST: ${{ secrets.PROD_NEO4J_HOST }}
NEO4J_USERNAME: ${{ secrets.PROD_NEO4J_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.PROD_NEO4J_PASSWORD }}
run: npm run test:db
sync-assets:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Sync images to CDN
- name: Sync public/ to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: ${{ secrets.GA_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AC_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AC_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.GA_AWS_REGION }}
SOURCE_DIR: "public"
DEST_DIR: "assets"
restart-cluster:
runs-on: ubuntu-latest
needs:
- update-database
steps:
# Configure AWS
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.GA_DEPLOY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.GA_DEPLOY_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Rollout
uses: kodermax/kubectl-aws-eks@main
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: rollout restart -n graphacademy-prod deployment/graphacademy
invalidate-cache:
runs-on: ubuntu-latest
needs:
- sync-assets
steps:
# Configure AWS
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AC_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AC_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.GA_AWS_REGION }}
# Invalidate the CDN cache
- name: Invalidate CloudFront Cache
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.GA_CLOUDFRONT_DISTRIBUTION }}
PATHS: "/*"
AWS_REGION: ${{ secrets.GA_AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AC_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AC_SECRET_ACCESS_KEY }}