sdf #109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Hugo site | |
on: | |
push: | |
branches: [ '*' ] | |
pull_request: | |
branches: [ '*' ] | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
default: 'warning' | |
jobs: | |
transform: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
- name: Basic info | |
run: | | |
echo "Partial variables" | |
echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART }}" | |
echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART }}" | |
echo "Slug variables" | |
echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG }}" | |
echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" | |
echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" | |
echo " ref : ${{ env.GITHUB_REF_SLUG }}" | |
echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG }}" | |
echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG }}" | |
echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG }}" | |
echo "Slug URL variables" | |
echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}" | |
echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" | |
echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" | |
echo " ref : ${{ env.GITHUB_REF_SLUG_URL }}" | |
echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG_URL }}" | |
echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG_URL }}" | |
echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG_URL }}" | |
echo "Short SHA variables" | |
echo " sha : ${{ env.GITHUB_SHA_SHORT }}" | |
echo " pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
ref: master | |
submodules: false | |
# Setting true above seems to lead to submodule updation problems. | |
fetch-depth: 1 | |
- name: Update submodules | |
run: | | |
set -o xtrace | |
git submodule update --init --recursive | |
git submodule update --remote --merge --recursive | |
- name: Set content to pull request | |
if: ${{ github.event_name == 'pull_request'}} | |
uses: actions/checkout@master | |
with: | |
path: content | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.119.0" | |
# extended: true | |
# Step 3 - Clean and don't fail | |
- name: Clean build_github directory | |
run: rm -rf build_github | |
- name: Build hugo site pages | |
run: | | |
hugo | |
- name: Deploy | |
if: ${{ github.event_name != 'pull_request'}} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build_github | |
publish_branch: gh-pages | |
force_orphan: true # git history growth - even on non-src branches - makes cloning slow. |