-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (37 loc) · 1.26 KB
/
Copy pathdeploy-context-dev.yml
File metadata and controls
46 lines (37 loc) · 1.26 KB
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
name: Deploy context (Dev)
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-context-dev
cancel-in-progress: false
jobs:
build-and-deploy:
name: Build and deploy /context to CloudFront (Dev)
runs-on: ubuntu-latest
env:
S3_BUCKET: ${{ secrets.S3_BUCKET_CONTEXT_DEV }}
CF_DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_DEV }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build context files
run: bash scripts/copy-files.sh
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
aws-region: ap-southeast-1
- name: Sync context JSON to S3
run: |
aws s3 sync ./public/context "s3://${S3_BUCKET}/context/" \
--delete \
--content-type "application/json" \
--cache-control "public, max-age=31536000, immutable"
- name: Invalidate CloudFront /context/*
run: |
aws cloudfront create-invalidation \
--distribution-id "${CF_DISTRIBUTION}" \
--paths "/context/*"