-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (48 loc) · 1.37 KB
/
node.js.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
name: Node.js CI and Deploy
on:
push:
branches:
- tmp
workflow_dispatch:
jobs:
build-and-deploy:
strategy:
matrix:
node-version: [20.x]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: check current directory
working-directory: ./strawberry
run: |
rm -rf node_modules/.cache
- name: Install dependencies
working-directory: ./strawberry
run: npm ci
- name: insert .env file in project
working-directory: ./strawberry
run: |
echo "${{ secrets.DOT_ENV }}" > ./.env
- name: Build
working-directory: ./strawberry
run: npm run build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
audience: sts.amazonaws.com
aws-region: ${{ secrets.DEFAULT_AWS_REGION }}
- name: Deploy to S3
run: aws s3 sync ./strawberry/dist/ s3://${{ secrets.AWS_S3_BUCKET }} --delete
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths /