From 2c77fdbfba643fbd201837c1dcff5fcdf340da39 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 28 Mar 2025 15:23:02 +0000 Subject: [PATCH] ci: deploy the website from GitHub Actions --- .github/workflows/update-manual.yml | 35 ---------------------- .github/workflows/update-website.yml | 45 ++++++++++++++++++++++++++++ doc/website/index.html | 24 +++++++++++++++ flake.nix | 7 +++++ 4 files changed, 76 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/update-manual.yml create mode 100644 .github/workflows/update-website.yml create mode 100644 doc/website/index.html diff --git a/.github/workflows/update-manual.yml b/.github/workflows/update-manual.yml deleted file mode 100644 index 8d2af53..0000000 --- a/.github/workflows/update-manual.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Update manual -on: - push: - branches: - - master - -jobs: - update-manual: - runs-on: macos-13 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # So that we fetch all branches, since we need to checkout the `gh-pages` branch later. - fetch-depth: 0 - - - name: Install Nix - uses: cachix/install-nix-action@v30 - - - name: Build manual - run: | - nix build .#manualHTML - - - name: Push update to manual - run: | - git checkout gh-pages - rm -rf manual - cp -R result/share/doc/darwin manual - rm result - git checkout master -- README.md - git config user.name github-actions - git config user.email github-actions@github.com - git add --all - git commit -m "Update manual" - git push diff --git a/.github/workflows/update-website.yml b/.github/workflows/update-website.yml new file mode 100644 index 0000000..06ce8e0 --- /dev/null +++ b/.github/workflows/update-website.yml @@ -0,0 +1,45 @@ +name: Update website + +on: + push: + branches: + - master + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build + runs-on: macos-14 + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + persist-credentials: false + - name: Install Nix + uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f + - name: Build website + run: nix build .#website -o _site + - name: Upload website + id: deployment + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa + + # See: + deploy: + name: Deploy + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-24.04 + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e diff --git a/doc/website/index.html b/doc/website/index.html new file mode 100644 index 0000000..173ac65 --- /dev/null +++ b/doc/website/index.html @@ -0,0 +1,24 @@ + + + + + nix-darwin + + + + +

nix-darwin

+

+ nix-darwin is a declarative configuration system for macOS, based + on Nix. See the + GitHub + repository for more information. +

+ + diff --git a/flake.nix b/flake.nix index 92569fa..bba2cdc 100644 --- a/flake.nix +++ b/flake.nix @@ -78,6 +78,13 @@ default = self.packages.${system}.darwin-rebuild; inherit (pkgs) darwin-option darwin-rebuild darwin-version darwin-uninstaller; + + # TODO: Include manuals for active release branches in the website. + # (This may involve moving it to a separate repository.) + website = pkgs.linkFarm "nix-darwin-website" { + "index.html" = ./doc/website/index.html; + manual = self.packages.${system}.manualHTML; + }; }))); }; }