Skip to content

Commit

Permalink
Update nix file to use a flake and update github workflows to match.
Browse files Browse the repository at this point in the history
  • Loading branch information
paperdigits committed Feb 21, 2024
1 parent 926fb6c commit 15dbd68
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 62 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@ on:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: recursive # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-shell --run 'echo "Installed nix dependencies"'
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install assets
run: nix-shell --run 'cd themes/hugo-darktable-docs-theme/assets/ && yarn install'
run: nix develop --command bash -c "cd themes/hugo-darktable-docs-theme/assets/ && yarn install"

- name: Run linkchecker
run: nix-shell --run 'hugo server --disableFastRender -verbose --config config.yaml -b https://darktable-org.github.io/dtdocs/ & sleep 30 && linkchecker --ignore-url .*pdf$ --ignore-url .*epub$ --no-status http://localhost:1313/dtdocs/index.html && pkill hugo'
- name: Check for broken links
run: nix develop --command bash -c "hugo server --disableFastRender -verbose --config config.yaml -b http://localhost:1313/dtdocs/ & sleep 30 && lychee --exclude \.*pdf$ --exclude \.*epub$ --exclude \.*#$ --no-progress http://localhost:1313/dtdocs/index.html && pkill hugo"

- name: build site
run: nix-shell --run './tools/build-all.sh https://darktable-org.github.io/dtdocs/'
run: nix develop --command bash -c "./tools/build-all.sh https://darktable-org.github.io/dtdocs/"

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@ on:

jobs:
pull-request-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: recursive # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-shell --run 'echo "Installed nix dependencies"'
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install assets
run: nix-shell --run 'cd themes/hugo-darktable-docs-theme/assets/ && yarn install'
run: nix develop --command bash -c "cd themes/hugo-darktable-docs-theme/assets/ && yarn install"

- name: Run linkchecker
run: nix-shell --run 'hugo server --disableFastRender -verbose --config config.yaml -b https://darktable-org.github.io/dtdocs/ & sleep 30 && linkchecker --ignore-url .*pdf$ --ignore-url .*epub$ --no-status http://localhost:1313/dtdocs/index.html && pkill hugo'
- name: Check for broken links
run: nix develop --command bash -c "hugo server --disableFastRender -verbose --config config.yaml -b http://localhost:1313/dtdocs/ & sleep 30 && lychee --exclude \.*pdf$ --exclude \.*epub$ --exclude \.*#$ --no-progress http://localhost:1313/dtdocs/index.html && pkill hugo"

- name: Generate translated files
run: nix-shell --run 'cd tools && bash generate-translations.sh --no-update'
run: nix develop --command bash -c "cd tools && bash generate-translations.sh --no-update"

- name: Clear
run: nix-shell --run 'rm -rf public'
run: nix develop --command bash -c "rm -rf public"

- name: Build
run: nix-shell --run 'hugo'
run: nix develop --command bash -c "hugo"
27 changes: 27 additions & 0 deletions flake.lock

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

54 changes: 54 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
description = "An environment for developing darktable's documentation";

inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
};

outputs = { self, nixpkgs }: {
devShell.x86_64-linux =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
pkgs.mkShell {
packages = with pkgs; [
hugo
yarn
rsync
gitFull
perlPackages.Po4a
python311Packages.weasyprint
lychee
zip
];
shellHook = ''
PROJECTDIR=`pwd`
hugo-deploy() {
echo "This doesn't do anything, but maybe it will one day."
}
update-assets() {
cd $PROJECTDIR && cd themes/hugo-darktable-docs-theme/assets && yarn install && cd $PROJECTDIR
}
generate-po() {
cd $PROJECTDIR && cd tools/ && ./generate-translations.sh --no-translations && cd $PROJECTDIR
}
generate-translated-files() {
cd $PROJECTDIR && cd tools/ && ./generate-translations.sh --no-update && cd $PROJECTDIR
}
remove-translated-files() {
# cd $PROJECTDIR && cd tools/ && ./generate-translations.sh --rm-translations && cd $PROJECTDIR # This is really slow
cd $PROJECTDIR
find . -name '*.de.md' -exec rm {} \;
find . -name '*.es.md' -exec rm {} \;
find . -name '*.fr.md' -exec rm {} \;
find . -name '*.nl.md' -exec rm {} \;
find . -name '*.pl.md' -exec rm {} \;
find . -name '*.pt_br.md' -exec rm {} \;
find . -name '*.uk.md' -exec rm {} \;
}
'';
};
};
}
42 changes: 0 additions & 42 deletions shell.nix

This file was deleted.

0 comments on commit 15dbd68

Please sign in to comment.