Skip to content
Open
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
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "httparchive"
}
}
23 changes: 12 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Custom HTTP Archive GitHub action ##
######################################
#
# Deploys the website to Google App Engine (production) on every push to main.
# Deploys the website to Firebase Hosting (production live channel) on every push to main.
# Requires a GCP service account key stored as the GCP_SA_KEY repository secret.
#
name: Deploy to Production
Expand All @@ -12,9 +12,13 @@ on:
branches:
- main

permissions:
checks: write
contents: read

jobs:
deploy:
name: Build and Deploy to App Engine
name: Build and Deploy to Firebase Hosting (Production)
runs-on: ubuntu-latest
if: github.repository == 'HTTPArchive/httparchive.org'
steps:
Expand All @@ -32,13 +36,10 @@ jobs:
- name: Build website
run: npm run build

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v3
- name: Deploy to Firebase Hosting (Live)
uses: FirebaseExtended/action-hosting-deploy@v0
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v3

- name: Deploy to App Engine
run: echo "Y" | gcloud app deploy app.yaml --project httparchive
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.GCP_SA_KEY }}'
channelId: live
projectId: httparchive
35 changes: 35 additions & 0 deletions .github/workflows/firebase-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy to Firebase Hosting Preview

on:
pull_request:

permissions:
checks: write
contents: read
pull-requests: write

jobs:
build_and_preview:
if: github.repository == 'HTTPArchive/httparchive.org'
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v7

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

- name: Install dependencies
run: npm ci || npm install

- name: Build website
run: npm run build

- name: Deploy to Firebase Hosting Preview Channel
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.GCP_SA_KEY }}'
projectId: httparchive
2 changes: 1 addition & 1 deletion .github/workflows/test-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js for use with actions
uses: actions/setup-node@v7
with:
node-version: '26'
node-version: '24'

- name: Run the website
env:
Expand Down
68 changes: 0 additions & 68 deletions app.yaml

This file was deleted.

53 changes: 53 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"cleanUrls": true,
"trailingSlash": false,
"headers": [
{
"source": "**",
"headers": [
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "strict-origin-when-cross-origin"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31556926; includeSubDomains"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self' https:; script-src 'self' https: 'unsafe-inline'; style-src 'self' https: 'unsafe-inline'; img-src 'self' https: data:; font-src 'self' https: data:; connect-src 'self' https:;"
}
]
},
{
"source": "/static/fonts/**",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
}
]
},
"emulators": {
"hosting": {
"port": 8080
}
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
"build": "npm run timestamps && npm run generate && npm run astro:build",
"astro:build": "astro build",
"astro:dev": "astro dev",
"start": "astro dev",
"deploy": "npm run build && gcloud app deploy app.yaml",
"start": "npm run build && npx -y firebase-tools@latest emulators:start --only hosting",
"stage": "npm run build && npx -y firebase-tools@latest hosting:channel:deploy staging",
"deploy": "npm run build && npx -y firebase-tools@latest deploy --only hosting",
"lint": "run-script-os",
"lint:darwin:linux": "docker container run -it --rm --platform linux/amd64 -e SHELL=/bin/bash -v \"$PWD\":/app -w /app --entrypoint=./tools/scripts/run_linter_locally.sh ghcr.io/super-linter/super-linter:slim-v8",
"lint:win32": "docker container run --rm -e SHELL=/bin/bash -v \"%cd%\":/app -w /app/ --entrypoint=./tools/scripts/run_linter_locally.sh ghcr.io/super-linter/super-linter:slim-v8",
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/run_and_test_website.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ echo "Building website"
call npm run build

echo "Starting website"
start npx -y serve dist -p 8080
start npx -y firebase-tools@latest emulators:start --only hosting
rem # Sleep for 5 seconds to make sure server is up
timeout /t 5 /nobreak
rem # Use sleep as well in case running in GitBash where above command fails
Expand Down
14 changes: 7 additions & 7 deletions tools/scripts/run_and_test_website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ while getopts "h?d" opt; do
done
shift "$((OPTIND-1))" # Discard the options and sentinel --

# Kill existing static server if running
if pgrep -f "serve.*dist" > /dev/null; then
echo "Killing existing server to run a fresh version"
pkill -f "serve.*dist" || true
# Kill existing hosting emulator if running
if pgrep -f "firebase-tools.*hosting" > /dev/null; then
echo "Killing existing emulator to run a fresh version"
pkill -f "firebase-tools.*hosting" || true
fi

echo "Installing node modules"
Expand All @@ -53,8 +53,8 @@ npm install --legacy-peer-deps
echo "Building website"
npm run build

echo "Starting static server on port 8080 for tests"
npx -y serve dist -p 8080 &
echo "Starting Firebase Hosting emulator in background mode for tests"
npx -y firebase-tools@latest emulators:start --only hosting &
SERVER_PID=$!

# Ensure the background server is terminated on exit unless KEEP_SERVER_RUNNING is true
Expand All @@ -65,7 +65,7 @@ else
fi

echo "Waiting for server to start..."
timeout=15
timeout=45
while ! curl -s http://127.0.0.1:8080 > /dev/null; do
sleep 1
timeout=$((timeout-1))
Expand Down