forked from threemay/myDevOps_directory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CICD github actions.yml
63 lines (54 loc) · 1.77 KB
/
CICD github actions.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
name: Node.js CI
on:
push:
branches: [ master, devops]
pull_request:
branches: [ master ]
env:
AWS_REGION: ap-southeast-2
my_distribution_id: E3TYJ8V3ZY1B0O
jobs:
build-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
# node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
npm install -g yarn
yarn install
ls
- name: build
run: |
yarn run build || true
- name: test
# run: npm test
run: echo "fake test"
# - name: create infrastructure
# # run: npm test
# run: echo "fake test"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: upload to s3
# uses: actions/aws@v2.0.1
run: |
aws -cli --version
ls
aws s3 cp ./build/ s3://${{ secrets.S3BUCKETNAME }} --recursive
# aws s3api get-bucket-website --bucket ${{ secrets.S3BUCKETNAME }}
- name: invalidate cloudfront
# uses: actions/aws@v2.0.1
run: aws cloudfront create-invalidation --distribution-id ${{ env.my_distribution_id }} --paths "/*"
# - name: output aws s3 endpoint
# run: echo "http://{{ secrets.S3BUCKETNAME }}.s3-website-${{ env.AWS_REGION }}amazonaws.com/