workflow: add VitePress build steps

This commit is contained in:
lifehackerhansol
2024-09-16 12:12:32 -07:00
parent f464c6e1bf
commit 2e85a820bf
2 changed files with 30 additions and 57 deletions

View File

@@ -3,53 +3,42 @@ name: Deploy site
on: on:
push: push:
branches: [ master ] branches: [ master ]
workflow_dispatch:
jobs: jobs:
doc-deploy: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
submodules: recursive
- name: Set up Python 3.x - name: Configure GitHub Pages
uses: actions/setup-python@v4 uses: actions/configure-pages@v5
- name: Setup Node
uses: actions/setup-node@v4
with: with:
# Semantic version range syntax or exact version of a Python version node-version: 20
python-version: '3.11.0' cache: npm
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: npm ci
- name: Run Mkdocs - name: Build site
# Build the site using mkdocs run: npm run docs:build
run: mkdocs build --verbose --clean --strict
- name: Post-Mkdocs touch/copy files - name: Post-Mkdocs touch/copy files
# miscellaneous files needed for GitHub etc # miscellaneous files needed for GitHub etc
run: | run: |
touch site/.nojekyll touch docs/.vitepress/dist/.nojekyll
cp CNAME site/CNAME cp CNAME docs/.vitepress/dist/CNAME
- name: Deploy 🚀 - name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.1 uses: JamesIves/github-pages-deploy-action@v4.4.1
with: with:
branch: gh-pages # The branch the action should deploy to. branch: gh-pages # The branch the action should deploy to.
folder: site # The folder the action should deploy. folder: docs/.vitepress/dist # The folder the action should deploy.
clean: true # Automatically remove deleted files from the deploy branch clean: true # Automatically remove deleted files from the deploy branch

View File

@@ -1,42 +1,26 @@
name: Test build name: Test site build
on: on:
pull_request: pull_request:
branches: [ master ]
jobs: jobs:
build: doc-test:
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
submodules: recursive
- name: Set up Python 3.x - name: Setup Node
uses: actions/setup-python@v4 uses: actions/setup-node@v4
with: with:
# Semantic version range syntax or exact version of a Python version node-version: 20
python-version: '3.11.0' cache: npm
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: npm ci
- name: Run Mkdocs - name: Build site
# Build the site using mkdocs run: npm run docs:build
run: mkdocs build --verbose --clean --strict