blob: a7892eef2d65291340a8c79907f471c5280870e8 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy site to pages (hugo)
on:
pull_request:
push:
branches: ["master"] # Set a branch name to trigger deployment
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Hugo steps
steps:
- uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Node
uses: actions/setup-node@v2.4.0
with:
node-version: "16"
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.102.3'
extended: true
- uses: actions/cache@v2
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: Build Site (minify)
run: hugo --minify
- name: Deploy Site
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Refer: https://github.com/marketplace/actions/github-pages-action
publish_dir: ./public
publish_branch: asf-site
keep_files: true # A simple way to keep ".asf.yaml" file
commit_message: ${{ github.event.head_commit.message }}