-
Notifications
You must be signed in to change notification settings - Fork 4
45 lines (39 loc) · 1.28 KB
/
publish-docs-release.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
name: Publish MkDocs on Release
on:
release:
types:
- published
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install poetry
poetry install --with=dev
- name: Extract Major and Minor Version
run: |
VERSION_TAG=${{ github.event.release.tag_name }}
VERSION_TAG="${VERSION_TAG#v}" # Remove 'v' prefix if present
MAJOR="${VERSION_TAG%%.*}"
MINOR="${VERSION_TAG#*.}"
MINOR="${MINOR%%.*}"
MAJOR_MINOR_VERSION="${MAJOR}.${MINOR}"
echo "MAJOR_MINOR_VERSION=${MAJOR_MINOR_VERSION}" >> $GITHUB_ENV
- name: Deploy Updated Docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
poetry run mike deploy --push --force --message "Deploy docs for release ${{ github.event.release.tag_name }}" --update-alias $MAJOR_MINOR_VERSION latest
poetry run mike set-default --push latest