Skip to content

Commit

Permalink
ci: add mdbook workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Burgess Chang <[email protected]>
  • Loading branch information
brsvh committed May 25, 2024
1 parent 69a5bc0 commit c000b96
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 13 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Generate page

on:
push:
paths:
- 'doc/**'
workflow_call:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
mdbook:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Nix
uses: nixbuild/nix-quick-install-action@v26
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Generate pages
run: |
nix develop .#ci
nix run nixpkgs#mdbook -- build

- name: Copy book to page branch
run: |
git checkout page || git checkout --orphan page
find . -mindepth 1 -maxdepth 1 ! -name 'result-book' ! -name '.git' -exec rm -rf {} +
mv result-book/* ./
rm result-book -r
git add .
- name: Push book
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: page
commit_message: "docs: auto update"
commit_author: Burgess Chang <[email protected]>
commit_user_name: github-actions[bot]
commit_user_email: github-actions[bot]@users.noreply.github.com
1 change: 0 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
"colmena.cachix.org-1:7BzpDnjjH8ki2CT3f6GdOk7QAzPOl+1t3LvTLXqYcSg="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];

substituters = [
"https://mirrors.cernet.edu.cn/nix-channels/store"
"https://mirror.nju.edu.cn/nix-channels/store"
"https://mirror.sjtu.edu.cn/nix-channels/store"
"https://cache.nixos.org"
];
};

# Home Manager
Expand Down Expand Up @@ -172,6 +165,9 @@
nixpkgs = {
follows = "nixpkgs";
};
paisano = {
follows = "std/paisano";
};
std = {
follows = "std";
};
Expand Down
15 changes: 10 additions & 5 deletions nix/local/devshells.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ let
pkgs = nixpkgs;
in
{
ci = std.lib.dev.mkShell {
name = "ci";
nixago = with cell.nixago; [ mdbook ];
};

default = std.lib.dev.mkShell {
commands = [
# Development
{
package = pkgs.git;
category = "development";
package = pkgs.git;
}
{
category = "development";
Expand All @@ -21,20 +26,20 @@ in

# Tool
{
package = colmena.packages.colmena;
category = "tool";
package = colmena.packages.colmena;
}
{
package = pkgs.dconf2nix;
category = "tool";
package = pkgs.dconf2nix;
}
{
package = pkgs.fish;
category = "tool";
package = pkgs.fish;
}
{
package = std.packages.std;
category = "tool";
package = std.packages.std;
}
];

Expand Down

0 comments on commit c000b96

Please sign in to comment.