-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (68 loc) · 2.53 KB
/
Copy pathMANUAL_DOCS_PUBLISH.yml
File metadata and controls
81 lines (68 loc) · 2.53 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: "Manual Documentation Publish"
on:
workflow_dispatch:
inputs:
RELEASE_VERSION:
required: true
type: string
description: "Release version for documentation"
UPDATE_LATEST:
required: true
type: boolean
default: true
description: "Update the 'latest' alias to point to this version"
permissions:
contents: write
jobs:
UPDATE_DOCS:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install --only doc --no-interaction
- name: Fetch gh-pages branch
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
# Fetch the gh-pages branch
git fetch origin gh-pages:gh-pages || echo "No gh-pages branch exists yet"
- name: Release documentation with mike
id: deploy_docs
run: |
echo "Deploying documentation for version ${{ inputs.RELEASE_VERSION }}"
# Set up command based on whether to update latest alias
if [[ "${{ inputs.UPDATE_LATEST }}" == "true" ]]; then
echo "Updating 'latest' alias to point to version ${{ inputs.RELEASE_VERSION }}"
COMMAND="mike deploy --push --update-aliases ${{ inputs.RELEASE_VERSION }} latest"
else
echo "Not updating 'latest' alias"
COMMAND="mike deploy --push ${{ inputs.RELEASE_VERSION }}"
fi
# Execute the command
$COMMAND
continue-on-error: true
- name: Retry documentation release on failure
if: steps.deploy_docs.outcome == 'failure'
run: |
echo "First documentation deploy attempt failed, retrying..."
# Force-fetch the latest gh-pages branch
git fetch origin gh-pages:gh-pages --force
# Set up command based on whether to update latest alias
if [[ "${{ inputs.UPDATE_LATEST }}" == "true" ]]; then
mike deploy --push --update-aliases --force ${{ inputs.RELEASE_VERSION }} latest
else
mike deploy --push --force ${{ inputs.RELEASE_VERSION }}
fi