Skip to content

Commit af6f9e8

Browse files
committed
Add GitHub Actions workflow for enrollment checker static site deployment
1 parent 8bf5b1c commit af6f9e8

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Deploy Enrollment Checker
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- src/SEBT.EnrollmentChecker.Web/**
8+
- packages/**
9+
- pnpm-lock.yaml
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: deploy-enrollment-checker
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
environment: dev-co
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 24
31+
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@v4
34+
35+
- name: Get pnpm store directory
36+
id: pnpm-cache
37+
shell: bash
38+
run: echo "store=$(pnpm store path)" >> "$GITHUB_OUTPUT"
39+
40+
- name: Cache pnpm dependencies
41+
uses: actions/cache@v4
42+
with:
43+
path: ${{ steps.pnpm-cache.outputs.store }}
44+
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
45+
restore-keys: pnpm-${{ runner.os }}-
46+
47+
- name: Install dependencies
48+
run: pnpm install --frozen-lockfile
49+
50+
- name: Remove SSR-only API routes
51+
run: rm -rf src/SEBT.EnrollmentChecker.Web/src/app/api
52+
53+
- name: Build static export
54+
run: BUILD_STATIC=true pnpm --filter @sebt/enrollment-checker build
55+
env:
56+
STATE: co
57+
NEXT_PUBLIC_STATE: co
58+
NEXT_PUBLIC_API_BASE_URL: ${{ vars.ENROLLMENT_CHECKER_API_BASE_URL }}
59+
NEXT_PUBLIC_PORTAL_URL: ${{ vars.ENROLLMENT_CHECKER_PORTAL_URL }}
60+
NEXT_PUBLIC_APPLICATION_URL: ${{ vars.ENROLLMENT_CHECKER_APPLICATION_URL }}
61+
62+
- name: Upload static site artifact
63+
uses: actions/upload-artifact@v6
64+
with:
65+
name: enrollment-checker-out
66+
path: src/SEBT.EnrollmentChecker.Web/out/
67+
retention-days: 1
68+
69+
deploy-co:
70+
needs: build
71+
runs-on: ubuntu-latest
72+
environment: dev-co
73+
env:
74+
AWS_REGION: us-east-1
75+
steps:
76+
- name: Download static site artifact
77+
uses: actions/download-artifact@v7
78+
with:
79+
name: enrollment-checker-out
80+
path: out/
81+
82+
- name: Configure AWS credentials
83+
uses: aws-actions/configure-aws-credentials@v6
84+
with:
85+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
86+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
87+
aws-region: ${{ env.AWS_REGION }}
88+
89+
- name: Sync to S3
90+
run: |
91+
aws s3 sync out/ "s3://${{ vars.ENROLLMENT_CHECKER_S3_BUCKET }}" \
92+
--delete
93+
94+
- name: Invalidate CloudFront cache
95+
run: |
96+
aws cloudfront create-invalidation \
97+
--distribution-id "${{ vars.ENROLLMENT_CHECKER_DISTRIBUTION_ID }}" \
98+
--paths "/*"

0 commit comments

Comments
 (0)