Skip to content

Run Hugo build on all branches and PRs, deploy only on main #26

Run Hugo build on all branches and PRs, deploy only on main

Run Hugo build on all branches and PRs, deploy only on main #26

Workflow file for this run

name: GitHub Pages
on:
push:
branches:
- main
pull_request:
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Build
working-directory: ./exampleSite
run: hugo --minify --themesDir ../.. --baseURL https://normanderwan.github.io/Blogpaper/
- name: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: ./exampleSite/public
deploy:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4