-
-
Notifications
You must be signed in to change notification settings - Fork 97
63 lines (61 loc) · 2.22 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
63 lines (61 loc) · 2.22 KB
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
name: Build Documentation using MkDocs
on:
push:
# Pattern matched against refs/tags
tags:
- '**'
workflow_dispatch:
inputs:
version:
description: 'Docs version to deploy (e.g. 0.26.0)'
required: true
# Serialize deploys so two runs never race on pushing the gh-pages branch.
concurrency:
group: deploy-docs
cancel-in-progress: false
jobs:
build:
name: Build and Deploy Documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1.4
with:
version: 2.3.2
virtualenvs-create: false
- name: Install dependencies
run: |
poetry install --extras "all"
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Set release version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_ENV"
else
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
fi
- name: Show version
run: echo "Deploying docs version ${{ env.RELEASE_VERSION }}"
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Fetch existing docs branch
# The checkout above is shallow and only fetches the pushed tag, so the
# origin/gh-pages remote-tracking ref does not exist locally. mike's
# update_from_upstream() then no-ops, mike commits an orphan gh-pages,
# and the push is rejected as a non-fast-forward. Fetching the branch
# into the remote-tracking ref lets mike base the new commit on the
# current docs and fast-forward.
run: git fetch origin gh-pages:refs/remotes/origin/gh-pages || echo "gh-pages branch does not exist yet"
- name: Deploy
run: mike deploy --push --update-aliases "$RELEASE_VERSION" latest