-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (79 loc) · 2.71 KB
/
docs-python.yml
File metadata and controls
95 lines (79 loc) · 2.71 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
name: Publish Python Documentation
on:
workflow_dispatch:
env:
PYTHON_VERSION: '3.13'
jobs:
validate-version:
name: Validate Branch or Tag
runs-on: ubuntu-latest
steps:
- name: Validate Version Pattern
id: validate
run: |
echo "Checking branch or tag: ${{ github.ref_name }}"
if [[ "${{ github.ref_name }}" =~ ^py-v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "✅ Valid version pattern."
else
echo "❌ Version pattern mismatch! Expected: py-v[0-9]+\.[0-9]+\.[0-9]+"
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Validate Version Match
run: |
cd crates/imgddpy
VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "imgddpy") | .version')
EXPECTED_VERSION="py-v$VERSION"
CURRENT_BRANCH="${{ github.ref_name }}"
if [ "$EXPECTED_VERSION" = "$CURRENT_BRANCH" ]; then
echo "✅ Version matches the branch/tag: $CURRENT_BRANCH"
else
echo "❌ Version mismatch! Expected: $EXPECTED_VERSION, Found: $CURRENT_BRANCH"
exit 1
fi
coverage:
uses: ./.github/workflows/coverage.yml
needs: validate-version
with:
branch: ${{ github.ref_name }}
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
integration-tests:
uses: ./.github/workflows/integration.yml
needs: validate-version
with:
branch: ${{ github.ref_name }}
publish-docs:
needs: [coverage, integration-tests]
name: Release docs page
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Dependencies
run: |
cd crates/imgddpy/
pip install .[dev]
- name: Build and Deploy Documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Configure git
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@users.noreply.github.com"
# Fetch the gh-pages branch
git fetch origin gh-pages
# Extract version from the tag (py-v*)
VERSION=$(echo "${{ github.ref_name }}" | sed 's/^py-v//')
echo "VERSION extracted: $VERSION"
# Build and deploy using mike
cd crates/imgddpy/
mike deploy --push --update-aliases --branch gh-pages "$VERSION" latest
mike set-default --push --branch gh-pages latest