Skip to content

Commit

Permalink
Deploy Pages via Action
Browse files Browse the repository at this point in the history
Rather than through the classic process of creating a commit on gh-pages branch
  • Loading branch information
rafmudaf committed Jan 17, 2025
1 parent 6cf5297 commit 358d859
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions .github/workflows/deploy-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,57 @@ on:
# Time zone for GitHub is UTC, so adjust accordingly; -6 in the summer, -7 in the winter.
# Therefore, this runs at 6:00 PM Mountain Time on Monday, Wednesday, and Friday.
- cron: '00 00 * * 2,4,6'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
deploy-book:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Install dependencies
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r docs/requirements.txt
# pip install -e .
# Build the book
- name: Build the book
working-directory: ${{runner.workspace}}/WETOStack/docs/
run: |
jupyter-book build .
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
path: ${{runner.workspace}}/WETOStack/docs/_build/html

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 358d859

Please sign in to comment.