From 40208a27097958a3f662544aa151621f4aa30abe Mon Sep 17 00:00:00 2001 From: cuisongliu Date: Wed, 3 Aug 2022 00:25:57 +0800 Subject: [PATCH] feature(main): add pages Signed-off-by: cuisongliu --- .github/workflows/pages.yml | 49 +++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 0fc7124..384cedb 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,5 +1,5 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages +# 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 @@ -8,11 +8,6 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - inputs: - ref: - description: "Why trigger?" - required: true - type: string # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: @@ -25,23 +20,47 @@ concurrency: group: "pages" cancel-in-progress: true +# Default to bash +defaults: + run: + shell: bash + jobs: - # Single deploy job since we're just deploying - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + # Build job + build: runs-on: ubuntu-latest + env: + HUGO_VERSION: 0.99.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-64bit.deb \ + && sudo dpkg -i ${{ runner.temp }}/hugo.deb - name: Checkout uses: actions/checkout@v3 + with: + submodules: recursive - name: Setup Pages + id: pages uses: actions/configure-pages@v1 + - name: Build with Hugo + run: | + hugo \ + --minify \ + --baseURL ${{ steps.pages.outputs.base_url }} - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: - # Upload entire repository - path: '.' + path: ./public + + # Deployment job + 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@main + uses: actions/deploy-pages@v1