You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TRaSH-Guides/.github/workflows/deploy.yml

85 lines
2.3 KiB

name: Build and Deploy Docs
4 years ago
on:
push:
branches:
- master
pull_request:
4 years ago
jobs:
build:
name: Build docs
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.6
with:
fetch-depth: 0
sparse-checkout: |
docs
images
includes
overrides
- name: Setup python
uses: actions/setup-python@v5.1.0
with:
python-version: 3.x
- name: Get pip cache directory
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4.0.2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Build documentation
run: mkdocs build
deploy:
6 months ago
if: github.event.workflow_run.event == 'push' && contains(fromJson('["master", "main"]'), github.event.workflow_run.head_branch)
needs: build
4 years ago
name: Deploy docs
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
4 years ago
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.6
with:
fetch-depth: 0
sparse-checkout: |
docs
images
includes
overrides
- name: Setup python
uses: actions/setup-python@v5.1.0
4 years ago
with:
python-version: 3.x
- name: Get pip cache directory
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4.0.2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Deploy to GitHub Pages
run: mkdocs gh-deploy --force