From 0dc5b249ff05bbfbd659805aee4261065d5826c3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 5 Nov 2024 16:38:52 +0100 Subject: [PATCH] Build the Nix manual in CI and deploy to Netlify --- .github/workflows/build.yml | 4 ++++ .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ packaging/hydra.nix | 9 +++++++++ 3 files changed, 40 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e3c9872d..441f23c5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,10 @@ on: os: required: true type: string + manual: + required: false + type: boolean + default: false jobs: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60b75a439..4397d3747 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,3 +134,30 @@ jobs: flakehub: true - uses: DeterminateSystems/flakehub-cache-action@main - run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH MAX_FLAKES=50 flake-regressions/eval-all.sh + + manual: + if: github.event_name != 'merge_group' + needs: build_x86_64-linux + runs-on: blacksmith + steps: + - name: Checkout nix + uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + with: + flakehub: true + - uses: DeterminateSystems/flakehub-cache-action@main + - name: Build manual + run: nix build .#hydraJobs.manual + - uses: nwtgck/actions-netlify@v3.0 + with: + publish-dir: './result/share/doc/nix/manual' + production-branch: detsys-main + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy from GitHub Actions" + enable-pull-request-comment: true + enable-commit-comment: true + enable-commit-status: true + overwrites-pull-request-comment: true + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/packaging/hydra.nix b/packaging/hydra.nix index debd98cf2..4f9039cd3 100644 --- a/packaging/hydra.nix +++ b/packaging/hydra.nix @@ -181,6 +181,15 @@ in # Nix's manual manual = nixpkgsFor.x86_64-linux.native.nixComponents.nix-manual; + manualTarball = + with nixpkgsFor.x86_64-linux.native; + runCommand "determinate-nix-manual-${self.hydraJobs.manual.version}" + { } + '' + mkdir -p $out/tarballs + tar cvfz $out/tarballs/$name.tar.gz -C ${self.hydraJobs.manual}/share/doc/nix/manual . --transform "s/^./$name/" + ''; + # API docs for Nix's unstable internal C++ interfaces. internal-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents.nix-internal-api-docs;