Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Deploy Docusaurus to S3 + CloudFront

on:
# push:
# branches:
# - main
# paths:
# - 'docs-site/**'
# - '.github/workflows/deploy.yml'
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'docs-site/package-lock.json'

- name: Install dependencies
working-directory: docs-site
run: npm ci

- name: Build Docusaurus site
working-directory: docs-site
run: npm run build

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ap-northeast-1

- name: Sync to S3
working-directory: docs-site/build
run: |
aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET }} \
--delete \
--cache-control "public, max-age=31536000, immutable" \
--exclude "*.html" \
--exclude "*.xml" \
--exclude "*.json"

# HTML files with no cache
aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET }} \
--cache-control "public, max-age=0, must-revalidate" \
--content-type "text/html" \
--exclude "*" \
--include "*.html"

# XML and JSON files with short cache
aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET }} \
--cache-control "public, max-age=3600" \
--exclude "*" \
--include "*.xml" \
--include "*.json"

- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"

- name: Deployment summary
run: |
echo " Deployment completed successfully!"
echo "=� S3 Bucket: ${{ secrets.AWS_S3_BUCKET }}"
echo "< CloudFront Distribution: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}"
46 changes: 46 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Format Check

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
terraform-format:
name: Terraform Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.8

- name: Terraform Format Check
working-directory: infra
run: terraform fmt -check -recursive .

prettier-format:
name: Prettier Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
working-directory: docs-site
run: npm install

- name: Prettier Format Check
working-directory: docs-site
run: npm run format:check
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Dependencies
node_modules/
yarn.lock

# Production build
build/
dist/
.docusaurus/
.cache-loader/

# Terraform
**/.terraform/
**/.terraform.lock.hcl
**/terraform.tfstate
**/terraform.tfstate.backup
**/terraform.tfvars
**/lambda_build/
**/lambda_function.zip

# Environment variables
.env
.env.local
.env.*.local

# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
logs/
*.log

# OS
Thumbs.db
.DS_Store

# mise
.mise.local.toml
11 changes: 11 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# mise configuration for fullstack-docusaurus-cloudfront
# https://mise.jdx.dev/

[tools]
# Global tools
terraform = "1.9.8"
node = "20.18.0"

[env]
# Environment variables
_.file = ".env"
24 changes: 24 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Dependencies
node_modules/
package-lock.json
yarn.lock

# Build output
build/
dist/
.docusaurus/
.cache-loader/

# Terraform
.terraform/
.terraform.lock.hcl
*.tfstate
*.tfstate.backup
lambda_build/
*.zip

# Logs
*.log

# OS
.DS_Store
9 changes: 9 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": false,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf"
}
Loading