-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (62 loc) · 1.85 KB
/
ci.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
name: Run CI Suite
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
cypress:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- uses: cypress-io/github-action@224f894ce0b082eba28a3a4562f630c54a17b432
with:
start: npm run serve
wait-on: 'http://localhost:8080'
deploy:
needs: cypress
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: set deployment parameters
run: |
if ${{ github.ref == 'refs/heads/main' }}
then
echo "DESTINATION_DIR=prod" >> $GITHUB_ENV
else
case ${{ github.head_ref || github.ref}} in
main)
;;
stage*)
echo "DESTINATION_DIR=stage" >> $GITHUB_ENV
;;
test*)
echo "DESTINATION_DIR=test" >> $GITHUB_ENV
;;
dev*)
echo "DESTINATION_DIR=dev" >> $GITHUB_ENV
;;
esac
fi
- run: npm install && npm run build
if: env.DESTINATION_DIR
- name: deploy
if: env.DESTINATION_DIR
uses: jakejarvis/s3-sync-action@be0c4ab89158cac4278689ebedd8407dd5f35a83
with:
args: --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-2'
SOURCE_DIR: 'dist'
DEST_DIR: ${{ env.DESTINATION_DIR }}