Skip to content

Commit 9264c81

Browse files
committed
Update the build
1 parent 00963c9 commit 9264c81

5 files changed

Lines changed: 23 additions & 75 deletions

File tree

.cloudflare/pages.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/build_deploy.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- "**"
7+
branches-ignore:
8+
- cf-pages
79

810
jobs:
911
build_deploy:
@@ -32,7 +34,7 @@ jobs:
3234

3335
# Set safe branch name for preview deployments
3436
- name: Set safe branch name
35-
if: github.ref != 'refs/heads/main'
37+
if: github.ref != 'refs/heads/stable'
3638
id: branch
3739
run: |
3840
# Sanitize branch name: only allow alphanumeric, dots, underscores, hyphens
@@ -41,48 +43,52 @@ jobs:
4143
echo "safe=${SAFE_NAME}" >> $GITHUB_OUTPUT
4244
4345
# Build documentation with appropriate environment variables
44-
- name: Prepare deploy (main/stable)
45-
if: github.ref == 'refs/heads/main'
46+
- name: Prepare deploy (stable)
47+
if: github.ref == 'refs/heads/stable'
4648
run: |
4749
set -e # Exit on error
4850
export DOCS_VERSION=stable
4951
export DOCS_BASEURL=https://docs.openspp.org/
5052
export IS_PREVIEW=0
53+
export DOCS_GITHUB_VERSION=stable
5154
make deploy || { echo "Build failed"; exit 1; }
5255
5356
- name: Prepare deploy (preview)
54-
if: github.ref != 'refs/heads/main'
57+
if: github.ref != 'refs/heads/stable'
5558
run: |
5659
set -e # Exit on error
5760
export DOCS_VERSION=${{ steps.branch.outputs.safe }}
5861
export DOCS_BASEURL=https://docs.openspp.org/previews/${{ steps.branch.outputs.safe }}/
5962
export IS_PREVIEW=1
63+
export DOCS_GITHUB_VERSION=${GITHUB_REF_NAME}
6064
make deploy || { echo "Build failed"; exit 1; }
6165
6266
# Deploy stable documentation (main branch)
63-
- name: Deploy stable documentation
64-
if: github.ref == 'refs/heads/main'
67+
- name: Deploy stable documentation (to cf-pages branch)
68+
if: github.ref == 'refs/heads/stable'
6569
uses: peaceiris/actions-gh-pages@v3
6670
with:
6771
github_token: ${{ secrets.GITHUB_TOKEN }}
6872
publish_dir: _build/html
73+
publish_branch: cf-pages
6974
keep_files: true # Don't delete preview versions
7075

7176
# Deploy preview documentation (non-main branches)
72-
- name: Deploy preview documentation
73-
if: github.ref != 'refs/heads/main'
77+
- name: Deploy preview documentation (to cf-pages branch)
78+
if: github.ref != 'refs/heads/stable'
7479
uses: peaceiris/actions-gh-pages@v3
7580
with:
7681
github_token: ${{ secrets.GITHUB_TOKEN }}
7782
publish_dir: _build/html
83+
publish_branch: cf-pages
7884
destination_dir: previews/${{ steps.branch.outputs.safe }}
7985
keep_files: true # Don't delete other versions
8086

8187
- name: Display deployment status
8288
run: |
83-
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
89+
if [ "${{ github.ref }}" == "refs/heads/stable" ]; then
8490
echo "✅ Deployed stable documentation to https://docs.openspp.org/"
8591
else
8692
BRANCH_SAFE=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/g')
8793
echo "✅ Deployed preview documentation to https://docs.openspp.org/previews/${BRANCH_SAFE}/"
88-
fi
94+
fi

.github/workflows/cleanup_previews.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ on:
1818
jobs:
1919
cleanup:
2020
runs-on: ubuntu-latest
21-
if: github.ref == 'refs/heads/main' # Only run from main branch
21+
if: github.ref == 'refs/heads/stable' # Only run from stable branch
2222

2323
permissions:
2424
contents: write
2525
pages: write
2626

2727
steps:
28-
- name: Checkout gh-pages branch
28+
- name: Checkout cf-pages branch
2929
uses: actions/checkout@v3
3030
with:
31-
ref: gh-pages
31+
ref: cf-pages
3232

3333
- name: Cleanup old preview deployments
3434
run: |
@@ -168,4 +168,4 @@ Cleanup policy:
168168
echo "- Total previews found: $(wc -l < /tmp/preview_list.txt)" >> $GITHUB_STEP_SUMMARY
169169
fi
170170
echo "- Keep policy: ${KEEP_DAYS:-30} days, minimum ${KEEP_COUNT:-10} previews" >> $GITHUB_STEP_SUMMARY
171-
echo "- Cleanup completed successfully" >> $GITHUB_STEP_SUMMARY
171+
echo "- Cleanup completed successfully" >> $GITHUB_STEP_SUMMARY

cloudflare_build.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@
143143
DOCS_VERSION = os.getenv("DOCS_VERSION", "stable")
144144
DOCS_BASEURL = os.getenv("DOCS_BASEURL", "https://docs.openspp.org/")
145145
IS_PREVIEW = os.getenv("IS_PREVIEW", "0") == "1"
146+
# Prefer the exact Git ref for edit links on previews; fall back to DOCS_VERSION
147+
GITHUB_VERSION = os.getenv("DOCS_GITHUB_VERSION", ("stable" if not IS_PREVIEW else DOCS_VERSION))
146148

147149
# Update version display based on environment
148150
if DOCS_VERSION != "stable":
@@ -587,7 +589,7 @@
587589
"display_github": True,
588590
"github_user": "openspp", # Username
589591
"github_repo": "documentation", # Repo name
590-
"github_version": "main", # Version
592+
"github_version": GITHUB_VERSION, # Branch or tag used for edit links
591593
"conf_py_path": "/docs/", # Path in the checkout to the docs root
592594
"is_preview": IS_PREVIEW, # Flag for preview builds to add noindex meta tag
593595
}

0 commit comments

Comments
 (0)