|
76 | 76 | if: ${{ inputs.skip_build != true && (needs.validate.result == 'success' || inputs.deploy_only) }} |
77 | 77 | timeout-minutes: 15 |
78 | 78 | permissions: |
79 | | - contents: read |
80 | | - pages: write |
81 | | - id-token: write |
82 | | - environment: |
83 | | - name: github-pages |
84 | | - url: ${{ steps.deployment.outputs.page_url }} |
| 79 | + contents: write |
85 | 80 |
|
86 | 81 | steps: |
87 | 82 | - name: ⚡ Checkout |
@@ -154,97 +149,37 @@ jobs: |
154 | 149 | |
155 | 150 | echo "✅ Build artifacts verified - no modifications applied" |
156 | 151 |
|
157 | | - # ✅ Upload complete artifact without modifications |
158 | | - - name: ⚡ Upload Pages artifact |
159 | | - id: upload-artifact |
160 | | - uses: actions/upload-pages-artifact@v4 |
161 | | - with: |
162 | | - path: './dist' |
163 | | - name: 'github-pages' |
164 | | - retention-days: 1 |
165 | | - env: |
166 | | - # Increase buffer sizes to prevent overflow |
167 | | - NODE_OPTIONS: '--max-old-space-size=8192' |
168 | | - # Set environment for stable tar operations |
169 | | - TAR_OPTIONS: '--no-same-permissions --no-same-owner' |
170 | | - continue-on-error: false |
171 | | - |
172 | | - - name: ⚡ Fallback upload (DISABLED - was corrupting files) |
173 | | - if: false |
174 | | - run: | |
175 | | - echo "⚠️ Fallback mechanism disabled to prevent file corruption" |
176 | | - |
177 | | - # Remove any large image files that aren't critical |
178 | | - find dist-fallback/ -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" -o -name "*.webp" | while read file; do |
179 | | - if [ $(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null || echo 0) -gt 500000 ]; then |
180 | | - echo "Removing large image: $file" |
181 | | - rm "$file" |
182 | | - fi |
183 | | - done |
184 | | - |
185 | | - # Keep only essential files for basic functionality |
186 | | - echo "📦 Fallback artifact contents:" |
187 | | - find dist-fallback/ -type f -name "*.html" -o -name "*.css" -o -name "*.js" | head -20 |
188 | | - |
189 | | - echo "📦 Fallback artifact size:" |
190 | | - du -sh dist-fallback/ |
191 | | - |
192 | | - # Ensure we don't have any problematic file permissions |
193 | | - chmod -R 755 dist-fallback/ |
194 | | - |
195 | | - # Final size check |
196 | | - FALLBACK_SIZE=$(du -sb dist-fallback/ | cut -f1) |
197 | | - FALLBACK_SIZE_MB=$((FALLBACK_SIZE / 1024 / 1024)) |
198 | | - echo "📊 Fallback artifact size: ${FALLBACK_SIZE_MB}MB" |
199 | | - |
200 | | - if [ $FALLBACK_SIZE_MB -gt 100 ]; then |
201 | | - echo "⚠️ Warning: Fallback artifact is still large (${FALLBACK_SIZE_MB}MB)" |
202 | | - else |
203 | | - echo "✅ Fallback artifact size is acceptable" |
204 | | - fi |
205 | | - |
206 | | - echo "✅ Fallback artifact prepared safely" |
207 | | -
|
208 | | - - name: ⚡ Upload fallback artifact (DISABLED) |
209 | | - if: false |
210 | | - uses: actions/upload-pages-artifact@v4 |
211 | | - with: |
212 | | - path: './dist-fallback' |
213 | | - name: 'github-pages' |
214 | | - retention-days: 1 |
215 | | - env: |
216 | | - # Use minimal buffer settings for fallback |
217 | | - NODE_OPTIONS: '--max-old-space-size=2048' |
218 | | - |
| 152 | + # ✅ Deploy using gh-pages branch (more reliable for large files) |
219 | 153 | - name: ⚡ Deploy to GitHub Pages |
220 | | - id: deployment |
221 | | - uses: actions/deploy-pages@v4 |
222 | | - timeout-minutes: 15 |
223 | | - env: |
224 | | - # Increase timeout and buffer settings for large artifacts |
225 | | - NODE_OPTIONS: '--max-old-space-size=4096' |
226 | | - # Set longer timeout for CDN operations |
227 | | - GITHUB_PAGES_TIMEOUT: '900' |
| 154 | + uses: peaceiris/actions-gh-pages@v3 |
| 155 | + with: |
| 156 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 157 | + publish_dir: ./dist |
| 158 | + publish_branch: gh-pages |
| 159 | + force_orphan: true |
| 160 | + user_name: 'github-actions[bot]' |
| 161 | + user_email: 'github-actions[bot]@users.noreply.github.com' |
| 162 | + commit_message: 'Deploy: ${{ github.event.head_commit.message }}' |
228 | 163 |
|
229 | 164 | - name: ⚡ Verify deployment |
230 | 165 | run: | |
231 | | - echo "🚀 Deployment completed!" |
232 | | - echo "URL: ${{ steps.deployment.outputs.page_url }}" |
233 | | - sleep 10 |
234 | | - if curl -fsSL --max-time 15 "${{ steps.deployment.outputs.page_url }}" > /dev/null; then |
| 166 | + echo "🚀 Deployment completed to gh-pages branch!" |
| 167 | + echo "URL: https://khalilcharfi.github.io" |
| 168 | + sleep 15 |
| 169 | + if curl -fsSL --max-time 20 "https://khalilcharfi.github.io" > /dev/null; then |
235 | 170 | echo "✅ Site is accessible" |
236 | 171 | else |
237 | | - echo "⚠️ Site may not be fully propagated yet" |
| 172 | + echo "⚠️ Site may not be fully propagated yet (CDN delay)" |
238 | 173 | fi |
239 | 174 |
|
240 | 175 | - name: ⚡ Deployment summary |
241 | 176 | run: | |
242 | 177 | echo "## 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY |
243 | 178 | echo "### ✅ Status: Success" >> $GITHUB_STEP_SUMMARY |
244 | | - echo "### 🔗 URL: ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY |
| 179 | + echo "### 🔗 URL: https://khalilcharfi.github.io" >> $GITHUB_STEP_SUMMARY |
245 | 180 | echo "### 📅 Deployed: $(date -u)" >> $GITHUB_STEP_SUMMARY |
246 | 181 | echo "### 📦 Source: ${{ github.ref_name }} branch" >> $GITHUB_STEP_SUMMARY |
247 | | - echo "### 🏗️ Build: $(du -sh dist | cut -f1)" >> $GITHUB_STEP_SUMMARY |
| 182 | + echo "### 🏗️ Deployed via: gh-pages branch" >> $GITHUB_STEP_SUMMARY |
248 | 183 |
|
249 | 184 | summary: |
250 | 185 | name: 📊 Pipeline Summary |
|
0 commit comments