From bf6c1bfeba2d57eb1f89a24e3d2dbcd3d1fe8968 Mon Sep 17 00:00:00 2001 From: Paul Mucur Date: Sun, 5 Nov 2023 09:07:12 +0000 Subject: [PATCH] Automatically update docs site Rather than manually updating the docs at https://mudge.name/re2, configure GitHub Actions to do it automatically on every push to the main branch. Note we have to install redcarpet for YARD's Markdown support but redcarpet doesn't compile on Alpine so we make an optional Bundler group (see https://bundler.io/guides/groups.html#optional-groups-and-bundlewith). --- .github/workflows/docs.yml | 37 +++++++++++++++++++++++++++++++++++++ Gemfile | 5 +++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..54f5a4af --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,37 @@ +name: Build documentation + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + build: + runs-on: "ubuntu-latest" + env: + BUNDLE_WITH: docs + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler-cache: true + - run: bundle exec yardoc + - uses: actions/upload-pages-artifact@v2 + with: + path: "doc/" + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/Gemfile b/Gemfile index 95334810..62ab333f 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,8 @@ source "https://rubygems.org" gemspec gem "rake", "> 12.3.2" + +group :docs, optional: true do + gem "yard" + gem "redcarpet" +end