Repository navigation
119 lines (104 loc) · 3.48 KB
/
Copy pathdocs.yml
File metadata and controls
119 lines (104 loc) · 3.48 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Docs Update
on:
push:
branches:
- master
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.mike.yml'
- 'README.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'SECURITY.md'
- 'CHANGELOG.md'
- 'AGENTS.md'
- 'CLAUDE.md'
- '**/SKILL.md'
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: docs-deploy
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: '3.14'
- name: Install dependencies
run: |
pip install mkdocs-material
pip install "mkdocstrings[python]"
pip install mike
pip install pymarkdownlnt
pip install yq
pip install -e .
- name: Lint documentation
run: |
pymarkdownlnt scan -r -e ./.venv -e ./.git -e ./.github -e ./data -e ./djangoapi_guard -e ./tests .
- name: Configure 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 and Update Version
id: get_version
run: |
CURRENT_VERSION=$(yq -r '.aliases.latest' .mike.yml)
if [[ ! $CURRENT_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Invalid version format in .mike.yml: $CURRENT_VERSION"
exit 1
fi
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
if [[ -n "${{ secrets.DOCS_VERSION }}" ]]; then
STORED_VERSION=${{ secrets.DOCS_VERSION }}
echo "STORED_VERSION=$STORED_VERSION" >> $GITHUB_ENV
else
echo "::error::DOCS_VERSION secret not found"
exit 1
fi
if [[ "$CURRENT_VERSION" != "$STORED_VERSION" ]]; then
echo "::notice::Updating DOCS_VERSION from $STORED_VERSION to $CURRENT_VERSION"
echo "VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "UPDATE_SECRET=true" >> $GITHUB_ENV
else
echo "::notice::Versions match ($CURRENT_VERSION), no update needed"
echo "VERSION=$STORED_VERSION" >> $GITHUB_ENV
echo "UPDATE_SECRET=false" >> $GITHUB_ENV
fi
- name: Update Docs Version Secret
if: ${{ env.UPDATE_SECRET == 'true' }}
uses: rennf93/github-actions-secrets-mgmt@v1.5
with:
OWNER: ${{ github.repository_owner }}
REPOSITORY: ${{ github.event.repository.name }}
ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
SECRET_NAME: DOCS_VERSION
SECRET_VALUE: ${{ env.VERSION }}
- name: Deploy documentation
run: |
mike deploy --push ${{ env.VERSION }}
mike alias --update-aliases --push ${{ env.VERSION }} latest
mike set-default --push latest
- name: Deploy to GitHub Pages
run: |
mike list
git push origin gh-pages --force
- name: Update Context7 Documentation
id: context7
uses: rennf93/upsert-context7@1.1
with:
operation: refresh
- name: Show result
run: |
echo "Success: ${{ steps.context7.outputs.success }}"
echo "Status: ${{ steps.context7.outputs.status-code }}"
echo "Message: ${{ steps.context7.outputs.message }}"