blog

Log | Files | Refs

gh-pages.yml (2199B)


      1 name: Deploy Hugo PaperMod Demo to Pages
      2 
      3 on:
      4   push:
      5     paths-ignore:
      6       - "images/**"
      7       - "LICENSE"
      8       - "README.md"
      9     branches:
     10       - master
     11       - exampleSite
     12   workflow_dispatch:
     13     # manual run
     14     inputs:
     15       hugoVersion:
     16         description: "Hugo Version"
     17         required: false
     18         default: "latest"
     19 
     20 # Allow one concurrent deployment
     21 concurrency:
     22   group: "pages"
     23   cancel-in-progress: true
     24 
     25 # Default to bash
     26 defaults:
     27   run:
     28     shell: bash
     29 
     30 jobs:
     31   # Build job
     32   build:
     33     permissions:
     34       contents: read
     35     runs-on: ubuntu-latest
     36     env:
     37       HUGO_VERSION: ${{ github.event.inputs.hugoVersion || 'latest' }}
     38     steps:
     39       - name: Resolve Hugo version
     40         run: |
     41           if [ "${HUGO_VERSION}" = "latest" ]; then
     42             HUGO_VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep '"tag_name"' | sed 's/.*"v\([^"]*\)".*/\1/')
     43             echo "HUGO_VERSION=${HUGO_VERSION}" >> $GITHUB_ENV
     44           fi
     45       - name: Install Hugo CLI
     46         run: |
     47           wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-amd64.deb \
     48           && sudo dpkg -i ${{ runner.temp }}/hugo.deb
     49       - name: Checkout
     50         uses: actions/checkout@v6
     51         with:
     52           ref: exampleSite
     53       - name: Setup Pages
     54         id: pages
     55         uses: actions/configure-pages@v6
     56       - name: Get Theme
     57         run: git submodule update --init --recursive
     58       - name: Update theme to Latest commit
     59         run: git submodule update --remote --merge
     60       - name: Build with Hugo
     61         run: |
     62           hugo \
     63             --buildDrafts --gc \
     64             --baseURL ${{ steps.pages.outputs.base_url }}
     65       - name: Upload artifact
     66         uses: actions/upload-pages-artifact@v5
     67         with:
     68           path: ./public
     69   # Deployment job
     70   deploy:
     71     permissions:
     72       pages: write
     73       id-token: write
     74     environment:
     75       name: github-pages
     76       url: ${{ steps.deployment.outputs.page_url }}
     77     runs-on: ubuntu-latest
     78     needs: build
     79     steps:
     80       - name: Deploy to GitHub Pages
     81         id: deployment
     82         uses: actions/deploy-pages@v5