-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (45 loc) · 1.47 KB
/
deploy-website.yml
File metadata and controls
56 lines (45 loc) · 1.47 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
47
48
49
50
51
52
53
54
55
56
name: Deploy Website
on:
push:
branches: [main]
paths:
- "website/**"
- ".capabilities/**/*.capability.yaml"
- "packages/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/deploy-website.yml"
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
env:
AWS_REGION: us-east-1
AWS_S3_BUCKET: capabilitykit.com
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm install
- name: Build CLI
run: npm run build
- name: Generate website dependency viewer
run: node packages/cli/dist/index.js graph-viewer --output website/dependency-viewer.html --svg-output website/dependency-graph.svg
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Deploy to S3
run: aws s3 sync website/ "s3://${AWS_S3_BUCKET}" --delete
- name: Invalidate CloudFront cache
if: env.CLOUDFRONT_DISTRIBUTION_ID != ''
run: aws cloudfront create-invalidation --distribution-id "${CLOUDFRONT_DISTRIBUTION_ID}" --paths "/*"