-
Notifications
You must be signed in to change notification settings - Fork 21
58 lines (50 loc) · 1.56 KB
/
deploy.yaml
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
name: Build
on:
push:
paths:
- 'build/**/'
- 'legacy/*'
- 'package.json'
- 'src/**/*'
- '.github/workflows/deploy.yaml'
env:
BUCKET_PATH: theme/en/black-highlighter
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Bun
uses: oven-sh/setup-bun@v1
- name: Build
run: make
- name: Deploy (GitHub Pages)
uses: JamesIves/[email protected]
if: ${{ github.ref == 'refs/heads/master' }}
with:
branch: gh-pages
folder: dist
- name: Clean up for S3
run: make clean-up-s3
- name: Deploy (S3)
uses: emmiegit/s3-sync-action@main
if: ${{ github.ref == 'refs/heads/master' }}
with:
args: --delete
env:
AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }}
AWS_REGION: ${{ vars.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: dist
DEST_DIR: ${{ env.BUCKET_PATH }}
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
if: ${{ github.ref == 'refs/heads/master' }}
env:
DISTRIBUTION: ${{ secrets.CF_DISTRIBUTION }}
PATHS: /${{ env.BUCKET_PATH }}
AWS_REGION: ${{ vars.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}