Merge pull request #939 from Junnygram/fix-hugo-deprecation-935 #2299
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
| # Sample workflow for building and deploying a Hugo site to GitHub Pages | |
| name: Deploy Hugo site to Pages | |
| on: | |
| # Runs on pushes targeting the default branch | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '.github/**' | |
| - 'archive/**' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: pages-deployment | |
| cancel-in-progress: true | |
| # Default to bash | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| HUGO_VERSION: 0.157.0 | |
| steps: | |
| - name: Install Hugo CLI | |
| run: | | |
| wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
| && sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
| - name: Install Dart Sass | |
| run: sudo snap install dart-sass | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install Node.js dependencies | |
| run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" | |
| - name: Build with Hugo | |
| env: | |
| HUGO_ENVIRONMENT: production | |
| HUGO_ENV: production | |
| run: | | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --baseURL "/" | |
| cp CNAME public/CNAME | |
| touch public/.nojekyll | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./public | |
| publish_branch: gh-pages | |
| keep_files: true |