docs: Add github workflow for building and publishing docs
authorDan Nicholson <dbn@endlessos.org>
Thu, 20 May 2021 22:03:25 +0000 (16:03 -0600)
committerDan Nicholson <dbn@endlessos.org>
Fri, 21 May 2021 16:45:08 +0000 (10:45 -0600)
This uses the Jekyll Actions GitHub action to push the rendered docs to
the gh-pages branch rather than GitHub's automated docs flow. That will
allow greater control over how the docs are generated. Pushing to the
gh-pages branch only happens on pushes to main. For pull requests, the
docs are only built.

.github/workflows/docs.yml [new file with mode: 0644]

diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644 (file)
index 0000000..966f983
--- /dev/null
@@ -0,0 +1,62 @@
+---
+name: Docs
+on:
+  push:
+    branches: [main]
+  pull_request:
+    branches: [main]
+
+jobs:
+  docs:
+    name: Build documentation
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v2
+
+      # This is taken from ci/travis-install.sh but should probably be
+      # refactored.
+      - name: Install dependencies
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y \
+            attr \
+            bison \
+            cpio \
+            debhelper \
+            dh-autoreconf \
+            dh-systemd \
+            docbook-xml \
+            docbook-xsl \
+            e2fslibs-dev \
+            elfutils \
+            fuse \
+            gjs \
+            gnome-desktop-testing \
+            gobject-introspection \
+            gtk-doc-tools \
+            libarchive-dev \
+            libattr1-dev \
+            libcap-dev \
+            libfuse-dev \
+            libgirepository1.0-dev \
+            libglib2.0-dev \
+            libgpgme11-dev \
+            liblzma-dev \
+            libmount-dev \
+            libselinux1-dev \
+            libsoup2.4-dev \
+            libcurl4-openssl-dev \
+            procps \
+            zlib1g-dev \
+            python3-yaml
+
+      - name: Build and publish jekyll docs
+        uses: helaili/jekyll-action@v2
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          jekyll_src: docs
+          target_branch: gh-pages
+          # Only publish when pushing to main.
+          # XXX: Maybe this should only run on the release event?
+          build_only: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }}