Skip to content

Commit fec4814

Browse files
committed
Add Nix Jekyll Build, GitHub Actions artifact, static Java site server
1 parent 6646577 commit fec4814

5 files changed

Lines changed: 224 additions & 0 deletions

File tree

.github/workflows/jekyll-build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build Jekyll Site to Tarball
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Install Nix
19+
uses: DeterminateSystems/nix-installer-action@main
20+
21+
- name: Setup Nix cache
22+
uses: DeterminateSystems/magic-nix-cache-action@main
23+
24+
- name: Build site and create tarball
25+
run: nix run .#tarball
26+
27+
- name: Upload tarball as artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: bitcoinj-site-${{ github.sha }}
31+
path: bitcoinj-site.tar.gz
32+
retention-days: 30
33+
34+
- name: Create release on tag
35+
if: startsWith(github.ref, 'refs/tags/')
36+
uses: softprops/action-gh-release@v1
37+
with:
38+
files: bitcoinj-site.tar.gz
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ This is the source-code repository for the **bitcoinj** website, published at [b
77

88
This site is written in [GitHub-flavored Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github), built using the [Jekyll static site generator](https://jekyllrb.com) and published via [GitHub Pages](https://pages.github.com).
99

10+
## Building locally in a Nix Shell
11+
12+
The Nix development shell will install Jekyll for building and serving the site and Java 25 (if you want a simple Java-based tool to serve/test the static site.)
13+
14+
1. Run `nix develop`
15+
2. Run `jekyll build`
16+
17+
This will build the site into the `_site` directory.
18+
19+
## Serving the site locally
20+
21+
To serve the site with Jekyll and dynamic reloading:
22+
23+
* `jekyll serve --livereload --incremental`
24+
25+
To run a simple, local Java-based webserver to view the site use:
26+
27+
* `./scripts/JekyllServer.java`
28+
29+
## Building locally without Nix
30+
31+
If you install Jekyll 3.10.0 and Ruby 3.3, you should be able to use the same commands as shown above, but this is untested/unsupported. You should also be able to serve the generated static site with the Java 25 script.
32+
33+
## Building as a Nix Package
34+
35+
* `nix build .#`
36+
37+
This should build the package in `result`.
38+
1039
## Contributing
1140

1241
To report a documentation issue or make a suggestion for improvement use [GitHub Issues](). You can also submit a [pull-request](https://github.com/bitcoinj/bitcoinj.github.io/pulls) for the website.

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
description = "Development environment for bitcoinj.github.io Jekyll site";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/release-25.11";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
14+
# Ruby environment with Jekyll and bundler
15+
rubyEnv = pkgs.ruby_3_3.withPackages (ps: with ps; [
16+
jekyll
17+
kramdown-parser-gfm
18+
]);
19+
20+
in
21+
{
22+
devShells.default = pkgs.mkShell {
23+
buildInputs = with pkgs; [
24+
rubyEnv
25+
jdk25_headless
26+
];
27+
28+
shellHook = ''
29+
echo "=== bitcoinj.github.io development environment ==="
30+
echo ""
31+
echo "Available commands:"
32+
echo " jekyll build - Build the site to _site/"
33+
echo " jekyll serve - Serve the site locally at http://localhost:4000"
34+
echo " jekyll serve --livereload - Serve with auto-reload on changes"
35+
echo " ./scripts/JekyllServer.java - Serve the static site with a Java script"
36+
echo ""
37+
'';
38+
};
39+
40+
# Package that builds the site
41+
packages.default = pkgs.stdenv.mkDerivation {
42+
pname = "bitcoinj-site";
43+
version = "0.0.1";
44+
45+
src = ./.;
46+
47+
buildInputs = [ rubyEnv ];
48+
49+
buildPhase = ''
50+
export HOME=$TMPDIR
51+
jekyll build
52+
'';
53+
54+
installPhase = ''
55+
mkdir -p $out
56+
cp -r _site/* $out/
57+
'';
58+
};
59+
60+
# App for easy site building
61+
apps.build = {
62+
type = "app";
63+
program = "${pkgs.writeShellScript "build-site" ''
64+
set -e
65+
export HOME=$TMPDIR
66+
${rubyEnv}/bin/jekyll build
67+
echo "Site built to _site/"
68+
''}";
69+
};
70+
71+
apps.serve = {
72+
type = "app";
73+
program = "${pkgs.writeShellScript "serve-site" ''
74+
set -e
75+
export HOME=$TMPDIR
76+
${rubyEnv}/bin/jekyll serve --livereload
77+
''}";
78+
};
79+
80+
apps.tarball = {
81+
type = "app";
82+
program = "${pkgs.writeShellScript "create-tarball" ''
83+
set -e
84+
export HOME=$TMPDIR
85+
echo "Building site..."
86+
${rubyEnv}/bin/jekyll build
87+
echo "Creating tarball..."
88+
${pkgs.gnutar}/bin/tar -czf bitcoinj-site.tar.gz -C _site .
89+
echo "Tarball created: bitcoinj-site.tar.gz"
90+
''}";
91+
};
92+
}
93+
);
94+
}

scripts/JekyllServer.java

Whitespace-only changes.

0 commit comments

Comments
 (0)