-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (55 loc) · 1.67 KB
/
main.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
name: CI/CD
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Running npm install and installing gulp
run: |
cd web
npm install
- name: Running build
run: |
cd web
npm run build
check-secret:
runs-on: ubuntu-latest
outputs:
deploy-secrets: ${{ steps.deploy-secrets.outputs.defined }}
steps:
- id: deploy-secrets
if: "${{ env.DEPLOY_SECRETS != '' }}"
run: echo "::set-output name=defined::true"
env:
MY_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
deploy:
needs: check-secret
runs-on: ubuntu-latest
if: needs.check-secret.outputs.deploy-secrets == 'true'
steps:
- name: S3 Sync
uses: jakejarvis/[email protected]
with:
args: --delete --exclude 'scss/*' --exclude 'node_modules/*' --exclude package.json --exclude package-lock.json --exclude requirements.txt --exclude gulpfile.js
env:
AWS_S3_BUCKET: <s3-bucket>
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: <region>
SOURCE_DIR: web/dist
- name: Invalidate Cloudfront
uses: chetan/[email protected]
env:
DISTRIBUTION: <cloudfront-dist-id>
PATHS: '/*'
AWS_REGION: <region>
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}