All checks were successful
Deploy to S3 / deploy (push) Successful in 1m45s
Serve it as text/plain on deploy so browsers display the raw text instead of downloading; add .dockerignore so local image builds can't ship stale _site or host node_modules.
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: Deploy to S3
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: yarn build
|
|
|
|
- name: Deploy to S3
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq awscli > /dev/null
|
|
aws s3 sync _site/ s3://${{ vars.S3_BUCKET }} --delete
|
|
# sync guesses text/markdown for .md, which Firefox downloads
|
|
# instead of displaying; text/plain shows the raw text in the tab
|
|
aws s3 cp _site/CLAUDE.md s3://${{ vars.S3_BUCKET }}/CLAUDE.md \
|
|
--content-type "text/plain; charset=utf-8"
|
|
|
|
- name: Invalidate CloudFront
|
|
if: vars.CF_DISTRIBUTION_ID != ''
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
|
|
run: |
|
|
aws cloudfront create-invalidation \
|
|
--distribution-id ${{ vars.CF_DISTRIBUTION_ID }} \
|
|
--paths "/*"
|