chore: fix hugo #149
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: Deploy Hugo site to Pages | |
on: | |
push: | |
branches: | |
- main | |
- docs | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
HUGO_VERSION: 0.108.0 | |
steps: | |
- name: Cache Hugo CLI | |
id: cache-hugo | |
uses: actions/cache@v3 | |
with: | |
path: /usr/local/bin/hugo | |
key: ${{ runner.os }}-hugo-${{ env.HUGO_VERSION }} | |
restore-keys: | | |
${{ runner.os }}-hugo- | |
- name: Install Hugo CLI | |
if: steps.cache-hugo.outputs.cache-hit != 'true' | |
run: | | |
wget -O ${{ runner.temp }}/hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz \ | |
&& tar -xzf ${{ runner.temp }}/hugo.tar.gz -C ${{ runner.temp }} \ | |
&& sudo mv ${{ runner.temp }}/hugo /usr/local/bin/hugo | |
- name: Verify Hugo Installation | |
run: | | |
ls -l /usr/local/bin/hugo | |
/usr/local/bin/hugo version | |
- name: Install Dart Sass Embedded | |
run: sudo snap install dart-sass-embedded | |
- name: Checkout docs branch | |
uses: actions/checkout@v4 | |
with: | |
ref: docs | |
submodules: recursive | |
- name: Fetch main branch | |
run: git fetch origin main:main | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v4 | |
- name: Setup Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Cache Node.js dependencies | |
id: cache-node | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Node.js dependencies | |
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" | |
- name: Build with Hugo | |
env: | |
HUGO_ENVIRONMENT: production | |
HUGO_ENV: production | |
run: | | |
hugo \ | |
--minify \ | |
--baseURL "${{ steps.pages.outputs.base_url }}/" | |
- name: Copy hTWOo Core style guide | |
run: git checkout main -- docs/htwoo-core/* && mv -f docs/htwoo-core public/htwoo-core/ | |
- name: Copy hTWOo React style guide | |
run: git checkout main -- docs/htwoo-react/* && mv -f docs/htwoo-react public/htwoo-react/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: site | |
path: ./public | |
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@v3 | |
with: | |
artifact_name: site |