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