mirror of
https://github.com/numtide/treefmt.git
synced 2024-08-16 20:30:25 +03:00
Merge #226
226: docs: build and deploy with Nix r=zimbatm a=zimbatm Co-authored-by: zimbatm <zimbatm@zimbatm.com>
This commit is contained in:
commit
8709f4e322
22
.github/workflows/deployMkDocs.yml
vendored
22
.github/workflows/deployMkDocs.yml
vendored
@ -1,22 +0,0 @@
|
||||
# Build and deploy MkDocs to gh-pages for main branch
|
||||
name: docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install mkdocs-material
|
||||
|
||||
- name: build and deploy to GitHub Pages
|
||||
run: mkdocs gh-deploy --force --clean --verbose
|
37
.github/workflows/gh-pages.yml
vendored
Normal file
37
.github/workflows/gh-pages.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
# Build and deploy MkDocs to gh-pages for main branch
|
||||
name: gh-pages
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- staging
|
||||
- trying
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
gh-pages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v20
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
name: numtide
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
||||
- name: Build the docs
|
||||
id: build
|
||||
run: |
|
||||
nix build .#docs
|
||||
echo "result=$(readlink ./result)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
if: github.ref == 'refs/heads/main'
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: "${{ steps.build.outputs.result }}/"
|
1
.github/workflows/nix.yml
vendored
1
.github/workflows/nix.yml
vendored
@ -7,6 +7,7 @@ on:
|
||||
- trying
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
|
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
@ -1,4 +1,4 @@
|
||||
on: # rebuild any PRs and main branch changes
|
||||
on: # rebuild any PRs and default branch changes
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
|
@ -9,5 +9,6 @@ status = [
|
||||
"clippy",
|
||||
"clippy_check",
|
||||
"devShell default [x86_64-linux]",
|
||||
"gh-pages",
|
||||
"package default [x86_64-linux]"
|
||||
]
|
||||
|
@ -86,7 +86,9 @@ let
|
||||
shfmt
|
||||
terraform
|
||||
|
||||
mdbook
|
||||
# Docs
|
||||
mkdocs
|
||||
python310Packages.mkdocs-material
|
||||
]);
|
||||
});
|
||||
in
|
||||
|
@ -1,11 +1,30 @@
|
||||
{ mdbook, stdenv }:
|
||||
{ stdenv, mkdocs, python310Packages }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "treefmt-docs";
|
||||
buildInputs = [ mdbook ];
|
||||
src = ./.;
|
||||
buildPhase = "mdbook build";
|
||||
|
||||
src = builtins.path {
|
||||
name = "treefmt-docs";
|
||||
path = ./.;
|
||||
};
|
||||
|
||||
# Re-create the folder structure since mkdocs insists on having the
|
||||
# mkdocs.yml at the root of the repo.
|
||||
unpackPhase = ''
|
||||
cp -r --no-preserve=mode $src docs
|
||||
cp ${../mkdocs.yml} mkdocs.yml
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
mkdocs
|
||||
python310Packages.mkdocs-material
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
mkdocs build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mv book $out
|
||||
mv site $out
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user