Fix: url EMM2.0.md to EMM20.md dot in name cause 404 live #46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Hugo site to Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| actions: read | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Use GITHUB_TOKEN for organization repos | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@v2 | |
| with: | |
| hugo-version: 'latest' | |
| extended: true | |
| - name: Create deployment config | |
| run: | | |
| # Create a deployment-specific config with correct baseURL | |
| cp config.toml config.deploy.toml | |
| # Replace baseURL for GitHub Pages deployment | |
| # sed -i 's|baseURL = "/"|baseURL = "https://datatrustengineering.github.io/DataTrustEngineering/"|' config.deploy.toml | |
| # echo "Deployment config created with baseURL for GitHub Pages" | |
| sed -i 's|baseURL = "https://datatrustmanifesto.org/"|baseURL = "https://datatrustmanifesto.org/"|' config.deploy.toml | |
| echo "Deployment config created with baseURL for custom domain" | |
| cat config.deploy.toml | grep baseURL | |
| - name: Build with Hugo | |
| env: | |
| HUGO_ENVIRONMENT: production | |
| HUGO_ENV: production | |
| run: | | |
| echo "Current directory: $(pwd)" | |
| echo "Files in directory: $(ls -la)" | |
| echo "Hugo version: $(hugo version)" | |
| echo "Building with deployment config: config.deploy.toml" | |
| echo "Static files before build:" | |
| ls -la static/ | |
| ls -la static/css/ | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --config config.deploy.toml | |
| echo "Build complete. Contents of public/:" | |
| ls -la public/ | |
| echo "CSS files in public:" | |
| find public -name "*.css" -type f | |
| echo "Checking if CSS was copied:" | |
| ls -la public/css/ || echo "No public/css directory" | |
| - name: Deploy Correct Sitemap | |
| run: | | |
| echo "=== DEPLOYING CORRECT SITEMAP ===" | |
| echo "Hugo generated sitemap (likely empty):" | |
| head -3 public/sitemap.xml || echo "No sitemap generated" | |
| echo "Replacing with correct sitemap from static/:" | |
| cp static/sitemap.xml public/sitemap.xml | |
| echo "Deployed sitemap:" | |
| head -10 public/sitemap.xml | |
| echo "=== READY FOR DEPLOYMENT ===" | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./public | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |