Skip to content

Commit

Permalink
first try to use github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuball committed Dec 3, 2024
1 parent 410d7c4 commit 7437079
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/book.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
jobs:
deploy:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v29
- run: nix develop .#book -c mdbook build ./.
- if: ${{ github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book
name: Deploy to GitHub Pages
'on':
push:
branches:
- main
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ result
.cache/
.data/

# mdbook
docs/book/
docs/cells/
docs/index.html
docs/README.md

# nixago: ignore-linked-files
/treefmt.toml
8 changes: 8 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[book]
language = "en"
multilingual = false
src = "docs"
title = "Advent of Code 2024 - A report."

[build]
build-dir = "docs/book"
3 changes: 0 additions & 3 deletions cells/code/README.md

This file was deleted.

1 change: 1 addition & 0 deletions cells/code/challenges/day-01-part2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Part 2
1 change: 1 addition & 0 deletions cells/code/challenges/day-02-part2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Part 2
45 changes: 45 additions & 0 deletions cells/repository/configs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,49 @@ in {
includes = ["*.nix"];
};
};

github-workflow-book = mkNixago {
output = ".github/workflows/book.yaml";
hook.mode = "copy";

data = {
name = "Deploy to GitHub Pages";
on.push.branches = ["main"];

jobs.deploy = {
runs-on = "ubuntu-latest";
concurrency.group = "\${{ github.workflow }}-\${{ github.ref }}";
steps = [
{ uses = "actions/checkout@v4"; }
{ uses = "nixbuild/nix-quick-install-action@v29"; }
{ run = "nix develop .#book -c mdbook build ./."; }
{
uses = "peaceiris/actions-gh-pages@v4";
"if" = "\${{ github.ref == 'refs/heads/main' }}";
"with" = {
"github_token" = "\${{ secrets.GITHUB_TOKEN }}";
"publish_dir" = "./docs/book";
};
}
];
};
};
};

mdbook = mkNixago {
output = "book.toml";
hook.mode = "copy";

packages = with pkgs; [ mdbook ];

data = {
book = {
title = "Advent of Code 2024 - A report.";
language = "en";
multilingual = false;
src = "docs";
};
build.build-dir = "docs/book";
};
};
}
8 changes: 8 additions & 0 deletions cells/repository/devshells.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ in {
treefmt
];
};

book = mkShell {
name = "AoC 2024: Book";

nixago = with cell.configs; [
mdbook
];
};
}
13 changes: 13 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Summary

[Introduction](../README.md)

# Challenges

- [Day 1]()
- [Part 1](../cells/code/challenges/day-01-part1.md)
- [Part 2](../cells/code/challenges/day-01-part2.md)

- [Day 2]()
- [Part 1](../cells/code/challenges/day-01-part1.md)
- [Part 2](../cells/code/challenges/day-01-part2.md)

0 comments on commit 7437079

Please sign in to comment.