Skip to content

Commit

Permalink
Adds conditional jobs for hub
Browse files Browse the repository at this point in the history
One to ensure it's always built if there are contrib changes.

The other is that it's only deployed once pushed to main.
  • Loading branch information
skrawcz committed Sep 28, 2023
1 parent f08bec1 commit c39cbe7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docusaurus-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,47 @@ concurrency:
cancel-in-progress: false

jobs:
branch-build:
if: GITHUB_REF_NAME != 'main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1000
# 👇 Build steps
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install -e .
- name: Compile code to create pages
working-directory: contrib/docs
run: python compile_docs.py
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: yarn
# The action defaults to search for the dependency file
# (package-lock.json or yarn.lock) in the repository root, and uses
# its hash as a part of the cache key.
# https://github.com/actions/setup-node#caching-packages-dependencies
cache-dependency-path: "./contrib/docs/package-lock.json"
- name: Install dependencies
working-directory: contrib/docs
run: yarn install --frozen-lockfile --non-interactive
- name: Build
working-directory: contrib/docs
run: yarn build
# 👆 Build steps
deploy:
if: GITHUB_REF_NAME == 'main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down

0 comments on commit c39cbe7

Please sign in to comment.