-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (78 loc) · 2.56 KB
/
docs.yml
File metadata and controls
95 lines (78 loc) · 2.56 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# # .github/workflows/docs.yml
# name: Deploy Documentation
# on:
# push:
# tags:
# - 'v*.*.*'
# workflow_dispatch: # Allow manual triggering
# permissions:
# contents: write # This is the key addition - explicitly grant write permission
# jobs:
# deploy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0 # fetch all history for proper versioning
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -e ".[dev]"
# - name: Set up Git user
# run: |
# git config --local user.email "github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# - name: Extract version from tag
# id: get_version
# run: |
# echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
# - name: Deploy docs
# run: |
# mike deploy --push --update-aliases ${{ env.VERSION }} latest
# .github/workflows/docs.yml
name: Deploy Documentation
on:
workflow_run:
workflows: ["Publish Package"]
types:
- completed
branches:
- main
workflow_dispatch: # Allow manual triggering
permissions:
contents: write
jobs:
deploy:
# Only run if the package publish was successful
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all history for proper versioning
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Set up Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Get latest tag
id: get_tag
run: |
# Get the latest tag
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Deploy docs
run: |
mike deploy --push --update-aliases ${{ env.VERSION }} latest