|
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 |
| 1 | +name: Build and deploy OpenSPP documentation |
5 | 2 |
|
6 | 3 | on: |
7 | 4 | push: |
8 | 5 | branches-ignore: |
9 | 6 | - cf-pages |
10 | | - - stable # stable is handled by multiversion workflow |
11 | 7 |
|
12 | 8 | jobs: |
13 | 9 | build_deploy: |
@@ -36,15 +32,27 @@ jobs: |
36 | 32 |
|
37 | 33 | # Set safe branch name for preview deployments |
38 | 34 | - name: Set safe branch name |
| 35 | + if: github.ref != 'refs/heads/stable' |
39 | 36 | id: branch |
40 | 37 | run: | |
41 | 38 | # Sanitize branch name: only allow alphanumeric, dots, underscores, hyphens |
42 | 39 | # Replace all other characters with hyphens and limit to 50 characters |
43 | 40 | SAFE_NAME=$(echo ${GITHUB_REF_NAME} | sed 's/[^a-zA-Z0-9._-]/-/g' | cut -c1-50) |
44 | 41 | echo "safe=${SAFE_NAME}" >> $GITHUB_OUTPUT |
45 | 42 |
|
46 | | - # Build preview documentation |
| 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 | +
|
47 | 54 | - name: Prepare deploy (preview) |
| 55 | + if: github.ref != 'refs/heads/stable' |
48 | 56 | run: | |
49 | 57 | set -e # Exit on error |
50 | 58 | export DOCS_VERSION=${{ steps.branch.outputs.safe }} |
|
53 | 61 | export DOCS_GITHUB_VERSION=${GITHUB_REF_NAME} |
54 | 62 | make deploy || { echo "Build failed"; exit 1; } |
55 | 63 |
|
56 | | - # Deploy preview documentation |
| 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) |
57 | 75 | - name: Deploy preview documentation (to cf-pages branch) |
| 76 | + if: github.ref != 'refs/heads/stable' |
58 | 77 | uses: peaceiris/actions-gh-pages@v3 |
59 | 78 | with: |
60 | 79 | github_token: ${{ secrets.GITHUB_TOKEN }} |
|
65 | 84 |
|
66 | 85 | - name: Display deployment status |
67 | 86 | run: | |
68 | | - BRANCH_SAFE=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/g') |
69 | | - echo "✅ Deployed preview documentation to https://docs.openspp.org/previews/${BRANCH_SAFE}/" |
| 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 |
0 commit comments