-
Notifications
You must be signed in to change notification settings - Fork 17
68 lines (55 loc) · 1.75 KB
/
docs-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Publish Documentation
on:
push:
branches:
- main
- docs-update
tags:
- "**"
env:
COLUMNS: 150
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 0
- name: checkout current branch
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Check docs build
run: |
poetry run mkdocs build
- name: Run tests
run: |
poetry run pytest
env:
OPENAI_API_KEY: "sk-fake-test-key-123"
- name: Set git credentials
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Deploy on push to main
if: ${{ github.ref == 'refs/heads/main' }}
run: |
poetry run mike deploy -b gh-pages dev --push
- name: Extract package version
if: ${{ github.ref == 'refs/heads/docs-update' || startsWith(github.ref, 'refs/tags/') }}
run: |
echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Deploy on push to docs-update branch or tag push
if: ${{ (github.ref == 'refs/heads/docs-update' || startsWith(github.ref, 'refs/tags/')) && !fromJSON(steps.check-version.outputs.IS_PRERELEASE) }}
run: |
poetry run mike deploy -b gh-pages ${{ env.VERSION }} latest --update-aliases --push