-
Notifications
You must be signed in to change notification settings - Fork 42
82 lines (72 loc) · 2.63 KB
/
production_deploy.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
name: Production deployment
on:
push:
branches: [ master ]
concurrency:
group: ci-tests-${{ github.ref }}-1
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
# Checkout code
- uses: actions/checkout@v3
# Install node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: app/package-lock.json
# Build
- name: Build
run: |
cd app/
npm ci --ignore-scripts
npm run build
# Inject SH Config file
- name: replace instance ID
uses: datamonsters/replace-action@v2
with:
files: 'app/dist/shConfig.js'
replacements: '$SH_INSTANCE_ID=${{ secrets.SH_INSTANCE_ID }},$SH_INSTANCE_ID_POLAR=${{ secrets.SH_INSTANCE_ID_POLAR }},$GEODB_INSTANCE_ID=${{ secrets.GEODB_INSTANCE_ID }},$LISTMONK_API_KEY=${{ secrets.LISTMONK_API_KEY }},$STAT_API_CLIENT_SECRET=${{ secrets.STAT_API_CLIENT_SECRET }},$STAT_API_CLIENT_ID=${{ secrets.STAT_API_CLIENT_ID }},$SH_INSTANCE_ID_GTIF=${{ secrets.SH_INSTANCE_ID_GTIF }}'
# Upload to S3
- name: sync s3
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --delete --follow-symlinks
env:
SOURCE_DIR: 'app/dist'
DEST_DIR: 'production'
AWS_REGION: 'eu-central-1'
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Invalidate Cloudfront distributions
- name: invalidate_esa
uses: chetan/invalidate-cloudfront-action@v1.2
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_PRODUCTION_ESA }}
PATHS: '/*'
AWS_REGION: 'eu-central-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: invalidate_trilateral
uses: chetan/invalidate-cloudfront-action@v1.2
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_PRODUCTION_TRILATERAL }}
PATHS: '/*'
AWS_REGION: 'eu-central-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Send notification
- name: action-slack
uses: 8398a7/action-slack@v3.15.1
with:
status: ${{ job.status }}
author_name: eodash_deploy
fields: repo,message,commit,author,action,eventName,ref,workflow
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always()