forked from Greenstand/treetracker-admin-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreetracker-admin-client-deploy-prod.yml
More file actions
64 lines (60 loc) · 1.93 KB
/
treetracker-admin-client-deploy-prod.yml
File metadata and controls
64 lines (60 loc) · 1.93 KB
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
name: Deploy Admin Panel Client to Prod Env
on:
workflow_dispatch:
inputs:
tag:
description: 'git-tag'
required: true
env:
project-directory: ./
jobs:
client:
name: Build Client Project
runs-on: ubuntu-latest
if: |
!contains(github.event.head_commit.message, 'skip-ci')
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: npm clean install
run: npm ci
working-directory: ${{ env.project-directory }}
- name: build client project
run: CI= REACT_APP_WEBMAP_DOMAIN=https://map.treetracker.org REACT_APP_API_ROOT=https://prod-k8s.treetracker.org/api/admin npm run build
working-directory: ${{ env.project-directory }}
- uses: actions/upload-artifact@v2
with:
name: client-bundle
path: build
deploy:
name: Deploy to CDN
runs-on: ubuntu-latest
needs: client
if: |
github.repository == 'Greenstand/treetracker-admin-client'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}
- name: Download bundled client resources
uses: actions/download-artifact@v2
with:
name: client-bundle
path: build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET }}
aws-region: us-east-1
- name: Copy front end resources to s3 bucket
run: |
aws s3 sync build s3://${{ secrets.PROD_CDN_S3_BUCKET }} --delete
- name: Invalidate cloudfront caches
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.PROD_CDN_DISTRIBUTION_ID }} --paths "/*"