From 02b0dd4650bc98cdda6987368f00a0a3f013f8fc Mon Sep 17 00:00:00 2001 From: Jeremy McCormick Date: Mon, 29 Jul 2024 14:44:44 -0500 Subject: [PATCH] Add workflow to build the site with Jekyll and deploy using ltd-upload --- .github/workflows/docs.yaml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..d6f7497c --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,67 @@ +name: Python CI + +env: + # Default Python version used for all jobs other than test, which uses a + # matrix of supported versions. Quote the version to avoid interpretation as + # a floating point number. + PYTHON_VERSION: "3.12" + +"on": + merge_group: {} + pull_request: {} + push: + branches-ignore: + # These should always correspond to pull requests, so ignore them for + # the push trigger and let them be triggered by the pull_request + # trigger, avoiding running the workflow twice. This is a minor + # optimization so there's no need to ensure this is comprehensive. + - "dependabot/**" + - "gh-readonly-queue/**" + - "renovate/**" + - "tickets/**" + - "u/**" + release: + types: [published] + +jobs: + + docs: + + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # full history for setuptools_scm + + - name: Install Ruby and other prerequisites + run: sudo apt-get install ruby-full build-essential zlib1g-dev + + - name: Install Jekyll + run: gem install bundler jekyll + + - name: Setup Ruby Gems environment + run: | + echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc + echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc + source ~/.bashrc + + - name: Build the schema browser site + run: jekyll build + + # Only attempt documentation uploads for tagged releases and pull + # requests from ticket branches in the same repository. This avoids + # version clutter in the docs and failures when a PR doesn't have access + # to secrets. + - name: Upload to LSST the Docs + uses: lsst-sqre/ltd-upload@v1 + with: + project: "sdm-schemas" + dir: "_site" + username: ${{ secrets.LTD_USERNAME }} + password: ${{ secrets.LTD_PASSWORD }} + if: > + github.event_name != 'merge_group' + && (github.event_name != 'pull_request' + || startsWith(github.head_ref, 'tickets/'))