-
Notifications
You must be signed in to change notification settings - Fork 21
66 lines (52 loc) · 1.76 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
59
60
61
62
63
64
65
66
name: Deploy
on:
push:
branches:
- master
env:
BUCKET_PATH: theme/en/black-highlighter
jobs:
build-and-deploy:
name: Deploy CSS
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Bun
uses: oven-sh/setup-bun@v1
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Build
run: make
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist/
- name: Deploy (GitHub Pages)
uses: actions/deploy-pages@v4
id: deployment
- name: Clean up for S3
run: make clean-up-s3
- name: Upload to S3
run: |
export sync_args=( "--delete" "--acl" "public-read" "dist" "s3://${{ vars.AWS_S3_BUCKET }}/${{ env.BUCKET_PATH }}" )
# Manually set content-types for anything aws-cli can't guess correctly
aws s3 sync ${sync_args[@]} --exclude "*" --include "*.css" --content-type "text/css; charset=utf-8"
aws s3 sync ${sync_args[@]} --exclude "*.css"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL: 'https://${{ vars.DIGITALOCEAN_SPACES_REGION }}.digitaloceanspaces.com'
AWS_DEFAULT_REGION: 'us-east-1'
- name: Invalidate Spaces Cache
run: doctl compute cdn flush $DIGITALOCEAN_CDN_ID
env:
DIGITALOCEAN_CDN_ID: ${{ vars.DIGITALOCEAN_CDN_ID }}