-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use a venv to build github pages (#3557)
- Loading branch information
1 parent
ac939ce
commit 27c610d
Showing
1 changed file
with
12 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,29 +16,24 @@ jobs: | |
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
cache: 'pip' | ||
cache-dependency-path: 'gh-pages/requirements-dev.txt' | ||
python-version: '3.8' | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
- name: Locate Caches | ||
id: cache-locations | ||
run: |- | ||
echo "::set-output name=pip-cache::$(python3 -m pip cache dir)" | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.cache-locations.outputs.pip-cache }} | ||
key: ${{ runner.os }}-${{ hashFiles('**/requirements-dev.txt') }} | ||
restore-keys: ${{ runner.os }}- | ||
- name: Install Dependencies | ||
run: |- | ||
pip install -r requirements-dev.txt | ||
python3 -m venv ${{ runner.temp }}/venv | ||
source ${{ runner.temp }}/venv/bin/activate | ||
python3 -m pip install -r requirements-dev.txt | ||
working-directory: gh-pages | ||
- name: Build DocSite | ||
run: |- | ||
mkdir -p ${{ runner.temp }}/site | ||
source ${{ runner.temp }}/venv/bin/activate | ||
mkdocs build \ | ||
--strict \ | ||
--site-dir ${{ runner.temp }}/site | ||
|
@@ -52,7 +47,7 @@ jobs: | |
publish: | ||
name: Publish | ||
needs: build | ||
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | ||
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
|
@@ -73,8 +68,9 @@ jobs: | |
git config user.email "[email protected]" | ||
- name: Prepare Commit | ||
run: |- | ||
rsync --delete --exclude=.git --exclude=dev --recursive ${{ runner.temp }}/site/ ./ | ||
touch .nojekyll | ||
rsync --archive --checksum --delete --inplace --recursive --verbose \ | ||
--exclude=.git --exclude=.nojekyll --exclude=dev \ | ||
${{ runner.temp }}/site/ ./ | ||
git add . | ||
git diff --cached --exit-code >/dev/null || ( | ||
git commit -am 'docs: publish from ${{ github.sha }}' | ||
|