Skip to content

Commit

Permalink
👷 Ci: adjust action to deploy gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
bambooom committed Feb 22, 2024
1 parent 57602b6 commit e9a00db
Showing 1 changed file with 35 additions and 8 deletions.
43 changes: 35 additions & 8 deletions .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
name: GitHub Pages
name: Build and Deploy to GitHub Pages

on:
push:
branches:
- master # Set a branch to deploy
# pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-22.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
Expand All @@ -17,6 +34,10 @@ jobs:
submodules: recursive # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup Pages
id: pages
uses: actions/configure-pages@v4

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
Expand All @@ -33,11 +54,17 @@ jobs:
${{ runner.os }}-hugomod-
- name: Build
run: hugo --minify
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master'
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
path: ./public

- name: Deploy
id: deployment
uses: actions/deploy-pages@v3

0 comments on commit e9a00db

Please sign in to comment.