Skip to content

Commit 27c610d

Browse files
committed
chore: use a venv to build github pages (#3557)
1 parent ac939ce commit 27c610d

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

.github/workflows/gh-pages.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,24 @@ jobs:
1616
contents: read
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Check out
20+
uses: actions/checkout@v3
1921
- name: Set up Python
2022
uses: actions/setup-python@v3
2123
with:
24+
cache: 'pip'
25+
cache-dependency-path: 'gh-pages/requirements-dev.txt'
2226
python-version: '3.8'
23-
- name: Check out
24-
uses: actions/checkout@v3
25-
- name: Locate Caches
26-
id: cache-locations
27-
run: |-
28-
echo "::set-output name=pip-cache::$(python3 -m pip cache dir)"
29-
- name: Cache
30-
uses: actions/cache@v3
31-
with:
32-
path: ${{ steps.cache-locations.outputs.pip-cache }}
33-
key: ${{ runner.os }}-${{ hashFiles('**/requirements-dev.txt') }}
34-
restore-keys: ${{ runner.os }}-
3527
- name: Install Dependencies
3628
run: |-
37-
pip install -r requirements-dev.txt
29+
python3 -m venv ${{ runner.temp }}/venv
30+
source ${{ runner.temp }}/venv/bin/activate
31+
python3 -m pip install -r requirements-dev.txt
3832
working-directory: gh-pages
3933
- name: Build DocSite
4034
run: |-
4135
mkdir -p ${{ runner.temp }}/site
36+
source ${{ runner.temp }}/venv/bin/activate
4237
mkdocs build \
4338
--strict \
4439
--site-dir ${{ runner.temp }}/site
@@ -52,7 +47,7 @@ jobs:
5247
publish:
5348
name: Publish
5449
needs: build
55-
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
50+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
5651
permissions:
5752
contents: write
5853
runs-on: ubuntu-latest
@@ -73,8 +68,9 @@ jobs:
7368
git config user.email "[email protected]"
7469
- name: Prepare Commit
7570
run: |-
76-
rsync --delete --exclude=.git --exclude=dev --recursive ${{ runner.temp }}/site/ ./
77-
touch .nojekyll
71+
rsync --archive --checksum --delete --inplace --recursive --verbose \
72+
--exclude=.git --exclude=.nojekyll --exclude=dev \
73+
${{ runner.temp }}/site/ ./
7874
git add .
7975
git diff --cached --exit-code >/dev/null || (
8076
git commit -am 'docs: publish from ${{ github.sha }}'

0 commit comments

Comments
 (0)