-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (59 loc) · 1.99 KB
/
aws-s3-cloudfront-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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy to S3 and invalidate CloudFront cache
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Where to deploy'
required: true
options:
- prod
- staging
jobs:
run:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build for production
if: github.event.inputs.environment == 'prod'
env:
VITE_APP_ID: ${{ secrets.VITE_APP_ID }}
run: npm run build
- name: Build for staging
if: github.event.inputs.environment == 'staging'
env:
VITE_APP_ID: ${{ secrets.STAGING_VITE_APP_ID }}
VITE_BAZAAR_URI: ${{ secrets.STAGING_VITE_BAZAAR_URI }}
run: npm run build
- name: Deploy to S3 and invalidate CloudFront - Production
if: github.event.inputs.environment == 'prod'
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{ secrets.S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: '{.*/**,**}'
- name: Deploy to S3 and invalidate CloudFront - Staging
if: github.event.inputs.environment == 'staging'
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{ secrets.STAGING_S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
dist-id: ${{ secrets.STAGING_CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: '{.*/**,**}'