Skip to content

Commit 3cd8c0c

Browse files
committed
ci: add deploy workflows
Also includes a nix-based dev env for build tooling, which will install requirements like `pnpm` and `firebase-tools`. Opts in to creating a fully static export of the site. Requires that we disable image optimization, which only works with a server on the backend. Uses the firebase-generated github action workflows to deploy to static-site hosting.
1 parent b4de8ea commit 3cd8c0c

12 files changed

+245
-23
lines changed

.envrc.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.firebaserc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "penumbra-guide"
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file was auto-generated by the Firebase CLI
2+
# https://github.com/firebase/firebase-tools
3+
#
4+
# It will build the static site and deploy it to the live prod URL.
5+
6+
name: Deploy to Firebase Hosting on merge
7+
on:
8+
push:
9+
branches:
10+
- main
11+
jobs:
12+
build_and_deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: install nix
17+
uses: DeterminateSystems/nix-installer-action@main
18+
- name: load nix cache
19+
uses: DeterminateSystems/magic-nix-cache-action@main
20+
21+
- name: build static docroot
22+
run: nix develop --command just build
23+
24+
- uses: FirebaseExtended/action-hosting-deploy@v0
25+
with:
26+
repoToken: ${{ secrets.GITHUB_TOKEN }}
27+
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PENUMBRA_GUIDE }}
28+
channelId: live
29+
projectId: penumbra-guide
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This file was auto-generated by the Firebase CLI
2+
# https://github.com/firebase/firebase-tools
3+
#
4+
# It will build the static site, deploy it to an ephemeral URL, and post a comment
5+
# to the PR with that URL for review.
6+
7+
name: Deploy to Firebase Hosting on PR
8+
on: pull_request
9+
permissions:
10+
checks: write
11+
contents: read
12+
pull-requests: write
13+
jobs:
14+
build_and_preview:
15+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: install nix
20+
uses: DeterminateSystems/nix-installer-action@main
21+
- name: load nix cache
22+
uses: DeterminateSystems/magic-nix-cache-action@main
23+
24+
- name: build static docroot
25+
run: nix develop --command just build
26+
27+
- uses: FirebaseExtended/action-hosting-deploy@v0
28+
with:
29+
repoToken: ${{ secrets.GITHUB_TOKEN }}
30+
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PENUMBRA_GUIDE }}
31+
projectId: penumbra-guide

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ yarn-error.log*
2424

2525
# Local env files
2626
.env*.local
27+
.envrc
28+
.direnv/
2729

2830
# Vercel
2931
.vercel
@@ -63,3 +65,6 @@ Thumbs.db
6365

6466
# Nextra specific
6567
.nextra
68+
69+
# Firebase static site hosting
70+
.firebase/

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Penumbra Guide
2+
3+
This repo holds the end-user documentation for Penumbra, hosted at [https://guide.penumbra.zone](https://guide.penumbra.zone).
4+
5+
## Contributing
6+
7+
1. Install [nix](https://nixos.org/download/).
8+
2. Run `nix develop --enable-experimental-features "nix-command flake"`
9+
3. Run `just dev` for a livereload environment.
10+
11+
## Directory layout
12+
13+
The documentation source resides in `pages/`. Docs files are written in [Markdown](https://www.markdownguide.org/),
14+
and served via [Nextra](https://nextra.site/).

firebase.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"hosting": {
3+
"public": "out",
4+
"redirects": [
5+
{
6+
"source": "/main/index.html",
7+
"destination": "/",
8+
"type": 302
9+
},
10+
{
11+
"regex": "/main/pd(?P<page>.*)",
12+
"destination": "/node/pd:page",
13+
"type": 302
14+
},
15+
{
16+
"regex": "/main/pclientd(?P<page>.*)",
17+
"destination": "/node/pclientd:page",
18+
"type": 302
19+
},
20+
{
21+
"regex": "/main/(?P<page>.*)",
22+
"destination": "/:page",
23+
"type": 302
24+
},
25+
{
26+
"source": "/node/pd/join-testnet.html",
27+
"destination": "/node/pd/join-network.html",
28+
"type": 302
29+
}
30+
]
31+
}
32+
}

flake.lock

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# in flake.nix
2+
{
3+
inputs = {
4+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+
flake-utils.url = "github:numtide/flake-utils";
6+
};
7+
outputs = { self, nixpkgs, flake-utils }:
8+
flake-utils.lib.eachDefaultSystem
9+
(system:
10+
let
11+
pkgs = import nixpkgs {
12+
inherit system ;
13+
};
14+
in
15+
with pkgs;
16+
{
17+
devShells.default = mkShell {
18+
buildInputs = [
19+
firebase-tools
20+
just
21+
pnpm
22+
];
23+
};
24+
}
25+
);
26+
}

justfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# display this help menu
2+
list:
3+
@just --list
4+
5+
# build static site
6+
build:
7+
pnpm install && pnpm build
8+
9+
# run dev env with livereload, for local editing
10+
dev:
11+
pnpm dev

next.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ const withNextra = require('nextra')({
33
themeConfig: './theme.config.jsx'
44
})
55

6-
module.exports = withNextra()
6+
module.exports = withNextra({
7+
// Attempt to generate static site, via https://nextjs.org/docs/pages/building-your-application/deploying/static-exports
8+
output: 'export',
9+
// Disable image optimization, as it doesn't work for SSG.
10+
images: {
11+
unoptimized: true,
12+
},
13+
})
714

815
// If you have other Next.js configurations, you can pass them as the parameter:
916
// module.exports = withNextra({ /* other next.js config */ })

pnpm-lock.yaml

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)