Hugo Build and Archive #66
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: Hugo Build and Archive | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.110.0" | |
extended: true | |
- name: Install Node.js Dependencies | |
run: npm install | |
working-directory: ${{ github.workspace }} | |
- name: Build Hugo Site | |
run: hugo --minify | |
- name: Set Sanitized Branch Name | |
id: sanitize | |
run: | | |
echo "SANITIZED_BRANCH_NAME=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV | |
- name: Upload Archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: public-archive-${{ env.SANITIZED_BRANCH_NAME }} | |
path: public | |
- name: Upload Archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: public-archive-${{ github.ref_name || 'main' }} | |
path: public |