Skip to content

Commit 58689db

Browse files
committed
fix: address CI workflow issues for multi-version deployment
- Disable csvlexer import in stable build (not in requirements) - Save version_switcher.js from stable before switching branches - Update old workflow to skip stable (now handled by multiversion) - Remove stable-specific code from old workflow (previews only)
1 parent 2b5f1cd commit 58689db

File tree

2 files changed

+22
-37
lines changed

2 files changed

+22
-37
lines changed

.github/workflows/build_deploy.yml

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
name: Build and deploy OpenSPP documentation
1+
name: Build and deploy OpenSPP documentation (previews only)
2+
3+
# NOTE: stable branch is now handled by build_deploy_multiversion.yml
4+
# This workflow only handles preview deployments for other branches
25

36
on:
47
push:
58
branches-ignore:
69
- cf-pages
10+
- stable # stable is handled by multiversion workflow
711

812
jobs:
913
build_deploy:
@@ -32,27 +36,15 @@ jobs:
3236

3337
# Set safe branch name for preview deployments
3438
- name: Set safe branch name
35-
if: github.ref != 'refs/heads/stable'
3639
id: branch
3740
run: |
3841
# Sanitize branch name: only allow alphanumeric, dots, underscores, hyphens
3942
# Replace all other characters with hyphens and limit to 50 characters
4043
SAFE_NAME=$(echo ${GITHUB_REF_NAME} | sed 's/[^a-zA-Z0-9._-]/-/g' | cut -c1-50)
4144
echo "safe=${SAFE_NAME}" >> $GITHUB_OUTPUT
4245
43-
# Build documentation with appropriate environment variables
44-
- name: Prepare deploy (stable)
45-
if: github.ref == 'refs/heads/stable'
46-
run: |
47-
set -e # Exit on error
48-
export DOCS_VERSION=stable
49-
export DOCS_BASEURL=https://docs.openspp.org/
50-
export IS_PREVIEW=0
51-
export DOCS_GITHUB_VERSION=stable
52-
make deploy || { echo "Build failed"; exit 1; }
53-
46+
# Build preview documentation
5447
- name: Prepare deploy (preview)
55-
if: github.ref != 'refs/heads/stable'
5648
run: |
5749
set -e # Exit on error
5850
export DOCS_VERSION=${{ steps.branch.outputs.safe }}
@@ -61,19 +53,8 @@ jobs:
6153
export DOCS_GITHUB_VERSION=${GITHUB_REF_NAME}
6254
make deploy || { echo "Build failed"; exit 1; }
6355
64-
# Deploy stable documentation (main branch)
65-
- name: Deploy stable documentation (to cf-pages branch)
66-
if: github.ref == 'refs/heads/stable'
67-
uses: peaceiris/actions-gh-pages@v3
68-
with:
69-
github_token: ${{ secrets.GITHUB_TOKEN }}
70-
publish_dir: _build/html
71-
publish_branch: cf-pages
72-
keep_files: true # Don't delete preview versions
73-
74-
# Deploy preview documentation (non-main branches)
56+
# Deploy preview documentation
7557
- name: Deploy preview documentation (to cf-pages branch)
76-
if: github.ref != 'refs/heads/stable'
7758
uses: peaceiris/actions-gh-pages@v3
7859
with:
7960
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -84,9 +65,5 @@ jobs:
8465

8566
- name: Display deployment status
8667
run: |
87-
if [ "${{ github.ref }}" == "refs/heads/stable" ]; then
88-
echo "✅ Deployed stable documentation to https://docs.openspp.org/"
89-
else
90-
BRANCH_SAFE=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/g')
91-
echo "✅ Deployed preview documentation to https://docs.openspp.org/previews/${BRANCH_SAFE}/"
92-
fi
68+
BRANCH_SAFE=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/g')
69+
echo "✅ Deployed preview documentation to https://docs.openspp.org/previews/${BRANCH_SAFE}/"

.github/workflows/build_deploy_multiversion.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ jobs:
4141
run: |
4242
pip install -q -r requirements_frozen.txt
4343
44+
- name: Prepare v1.3 build
45+
run: |
46+
# Temporarily disable csvlexer import (not in requirements_frozen.txt)
47+
sed -i 's/from csvlexer.csv import CsvLexer/# from csvlexer.csv import CsvLexer # disabled for CI/' docs/conf.py
48+
sed -i "s/lexers\['csv'\] = CsvLexer/# lexers['csv'] = CsvLexer # disabled for CI/" docs/conf.py
49+
50+
# Save version_switcher.js for later (before switching branches)
51+
cp docs/_static/version_switcher.js /tmp/version_switcher.js
52+
4453
- name: Build v1.3 documentation
4554
run: |
4655
set -e
@@ -108,11 +117,10 @@ jobs:
108117
# Copy to v1.3
109118
cp _build/html/_static/switcher.json _build/html/v1.3/_static/
110119
111-
# Copy version_switcher.js to both (if not already present)
112-
if [ -f "docs/_static/version_switcher.js" ]; then
113-
cp docs/_static/version_switcher.js _build/html/_static/
114-
cp docs/_static/version_switcher.js _build/html/v1.3/_static/
115-
fi
120+
# Copy version_switcher.js from stable (saved earlier) to both builds
121+
# This ensures we use the fixed version with proper regex
122+
cp /tmp/version_switcher.js _build/html/_static/
123+
cp /tmp/version_switcher.js _build/html/v1.3/_static/
116124
117125
echo "✅ Version switcher configured"
118126

0 commit comments

Comments
 (0)