-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.43 KB
/
deploy.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
name: Deployment to AWS S3
on:
pull_request:
push:
branches:
- master
jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
name: Build and deploy
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm i
- name: Build Angular & NestJS
run: npm run build
- name: Output content of build folder
run: ls -l build
- name: Generate build tar
run: tar -cf build.tar build package.json package-lock.json
# - name: Deploy master branch to S3
# if: github.ref == 'refs/heads/master'
# run: aws s3 sync ./build.tar ${{ secrets.AWS_SECRET_S3_BUCKET }} --delete
#
# - name: Deploy PR branch to S3
# if: github.event_name == 'pull_request'
# run: aws s3 sync ./build.tar ${{ secrets.AWS_SECRET_S3_BUCKET }}/test/${{ github.event.number }} --delete
# - name: Invalidate CloudFront
# run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*"