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
56 changes: 56 additions & 0 deletions .github/workflows/learn-hathor-website-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Learn Hathor Website Deploy

on:
workflow_call:
inputs:
environment:
description: 'Environment to deploy to (staging or production)'
required: true
type: string

defaults:
run:
working-directory: learn-hathor-website

env:
NODE_VERSION: '24'
AWS_REGION: 'us-east-1'

jobs:
deploy:
name: Deploy to ${{ inputs.environment }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: learn-hathor-website/package-lock.json

- name: Install dependencies
run: npm ci

- name: Configure AWS credentials (staging)
if: inputs.environment == 'staging'
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::769498303037:role/LearnHathorNetworkGitHubActionsRoleStaging
aws-region: ${{ env.AWS_REGION }}

- name: Configure AWS credentials (production)
if: inputs.environment == 'production'
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::769498303037:role/LearnHathorNetworkGitHubActionsRoleProduction
aws-region: ${{ env.AWS_REGION }}

- name: Deploy
run: make deploy site=${{ inputs.environment }}
68 changes: 68 additions & 0 deletions .github/workflows/learn-hathor-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Learn Hathor Website CI/CD

on:
push:
branches: [master]
tags:
- 'learn-hathor-website@*'
paths:
- 'learn-hathor-website/**'
- '.github/workflows/learn-hathor-website*.yml'
pull_request:
branches: [master]
paths:
- 'learn-hathor-website/**'
- '.github/workflows/learn-hathor-website*.yml'

defaults:
run:
working-directory: learn-hathor-website

env:
NODE_VERSION: '24'

jobs:
lint-and-test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: learn-hathor-website/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Check formatting
run: npm run format:check

- name: Type check
run: npm run typecheck

- name: Run tests
run: npm run test:coverage

deploy-staging:
name: Deploy to Staging
needs: lint-and-test
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: ./.github/workflows/learn-hathor-website-deploy.yml
with:
environment: staging

deploy-production:
name: Deploy to Production
needs: lint-and-test
if: startsWith(github.ref, 'refs/tags/learn-hathor-website@')
uses: ./.github/workflows/learn-hathor-website-deploy.yml
with:
environment: production
1 change: 0 additions & 1 deletion hello.py

This file was deleted.

35 changes: 35 additions & 0 deletions learn-hathor-website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Dependencies
node_modules/

# Build output
dist/

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

# OS
.DS_Store
Thumbs.db

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

# Testing
coverage/

# Logs
*.log
npm-debug.log*

# Cache
.eslintcache
.cache/
*.tsbuildinfo

# Old
.netlify
4 changes: 4 additions & 0 deletions learn-hathor-website/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
node_modules
coverage
*.md
11 changes: 11 additions & 0 deletions learn-hathor-website/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"printWidth": 80,
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf"
}
14 changes: 14 additions & 0 deletions learn-hathor-website/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.PHONY: build
build:
./scripts/deploy.sh $(site) build $(aws_profile)

.PHONY: sync
sync:
./scripts/deploy.sh $(site) sync $(aws_profile)

.PHONY: deploy
deploy: build sync clear_cloudfront_cache

.PHONY: clear_cloudfront_cache
clear_cloudfront_cache:
./scripts/deploy.sh $(site) clear_cache $(aws_profile)
Loading