Use Github Pages action

This commit is contained in:
JP Hastings-Spital 2022-10-23 15:52:18 +01:00
parent 8ec8b1cc0e
commit 63b2aa8af3

View file

@ -1,32 +1,63 @@
name: CI name: Deploy Hugo site to Pages
on: on:
push: push:
branches: branches: ["main"]
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
defaults:
run:
shell: bash
jobs: jobs:
deploy: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
concurrency: env:
group: ${{ github.workflow }} HUGO_VERSION: 0.104.3
steps: steps:
- name: Git checkout - 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-64bit.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 submodules: recursive
- name: Setup Pages
- name: Setup hugo id: pages
uses: peaceiris/actions-hugo@v2 uses: actions/configure-pages@v2
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with: with:
hugo-version: '0.104.3' path: ./public
extended: true
- name: Build # Deployment job
run: hugo --minify deploy:
environment:
- name: Deploy name: github-pages
uses: peaceiris/actions-gh-pages@v3 url: ${{ steps.deployment.outputs.page_url }}
with: runs-on: ubuntu-latest
personal_token: ${{ secrets.GITHUB_TOKEN }} needs: build
publish_dir: ./public steps:
cname: www.byjp.me - name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1