|
73 | 73 | needs: test |
74 | 74 | runs-on: ubuntu-latest |
75 | 75 | permissions: |
76 | | - pages: write # Required to deploy to GitHub Pages |
77 | | - id-token: write # Required for OIDC authentication |
| 76 | + contents: write # Required to push to gh-pages branch |
78 | 77 | steps: |
79 | 78 | - uses: actions/checkout@v4 |
80 | 79 |
|
@@ -106,62 +105,32 @@ jobs: |
106 | 105 | # Create version switcher for PyData Sphinx Theme navigation |
107 | 106 | run: python scripts/generate_switcher_json.py |
108 | 107 |
|
109 | | - - name: Prepare Pages artifact |
110 | | - # Assemble final site structure with docs and coverage in _site directory |
111 | | - run: | |
112 | | - mkdir -p _site |
113 | | - rsync -avr _build/ _site/ |
114 | | - mkdir -p _site/_static |
115 | | - cp docs/_static/switcher.json _site/_static/switcher.json |
116 | | - mkdir -p _site/coverage |
117 | | - if [ -d "tests/coverage" ]; then |
118 | | - rsync -avr tests/coverage/ _site/coverage/ |
119 | | - fi |
120 | | -
|
121 | | - - name: Setup Pages |
122 | | - # Configure GitHub Pages deployment settings |
123 | | - id: pages |
124 | | - uses: actions/configure-pages@v5 |
125 | | - |
126 | | - - name: Upload artifact |
127 | | - # Upload the complete site as a Pages deployment artifact |
128 | | - uses: actions/upload-pages-artifact@v3 |
129 | | - with: |
130 | | - path: _site |
131 | | - |
132 | | - - name: Deploy to GitHub Pages |
133 | | - # Deploy the uploaded artifact to GitHub Pages |
134 | | - id: deployment |
135 | | - uses: actions/deploy-pages@v4 |
136 | | - |
137 | | - - name: Create latest redirect |
138 | | - # Create a /latest/ redirect in gh-pages branch pointing to /stable/ |
| 108 | + - name: Deploy to gh-pages branch |
| 109 | + # Deploy docs to gh-pages branch in stable/ directory |
139 | 110 | run: | |
140 | 111 | git config user.name "github-actions[bot]" |
141 | 112 | git config user.email "github-actions[bot]@users.noreply.github.com" |
142 | 113 | git fetch origin gh-pages |
143 | 114 | git checkout gh-pages |
144 | 115 | git pull origin gh-pages |
| 116 | +
|
| 117 | + # Deploy to latest directory (main branch = latest) |
145 | 118 | rm -rf latest |
146 | 119 | mkdir -p latest |
147 | | - cat > latest/index.html << 'EOF' |
148 | | - <!DOCTYPE html> |
149 | | - <html> |
150 | | - <head> |
151 | | - <meta http-equiv="refresh" content="0; url=../stable/"> |
152 | | - <link rel="canonical" href="../stable/" /> |
153 | | - <title>Redirecting to stable documentation</title> |
154 | | - </head> |
155 | | - <body> |
156 | | - <p>Redirecting to <a href="../stable/">stable documentation</a>...</p> |
157 | | - </body> |
158 | | - </html> |
159 | | - EOF |
| 120 | + rsync -avr _build/ latest/ |
| 121 | +
|
| 122 | + # Add coverage if available |
| 123 | + if [ -d "tests/coverage" ]; then |
| 124 | + mkdir -p latest/coverage |
| 125 | + rsync -avr tests/coverage/ latest/coverage/ |
| 126 | + fi |
| 127 | +
|
| 128 | + # Commit and push |
160 | 129 | git add latest |
161 | | - git commit -m "Update latest redirect to stable" || echo "No changes to commit" |
| 130 | + git commit -m "Deploy docs to latest from main branch" || echo "No changes to commit" |
162 | 131 | git push origin gh-pages |
163 | | - echo "✅ Latest redirect updated!" |
164 | | - echo "🔗 https://datasophos.github.io/NexusLIMS/latest/ → stable" |
| 132 | + echo "✅ Documentation deployed to latest!" |
| 133 | + echo "🔗 https://datasophos.github.io/NexusLIMS/latest/" |
165 | 134 |
|
166 | 135 | deploy-pr-docs: |
167 | 136 | # Deploy documentation preview for pull requests to gh-pages branch |
|
0 commit comments