Skip to content

github pages

github pages #1064

Workflow file for this run

name: github pages
on:
push:
branches:
- main # Set a branch to deploy
schedule:
- cron: '30 0 * * *'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
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 Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
run: hugo --minify
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
working-directory: ./themes/aoepeople.github.io
- name: Build Tailwind
run: npm run build
working-directory: ./themes/aoepeople.github.io
# run again to include updated theme stylesheets after tailwind
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
if: github.ref == 'refs/heads/main'
run: hugo --minify
- name: Build Preview
if: github.event_name == 'pull_request'
run: hugo --minify -b https://opensource.aoe.com/_preview-opensource/${{ github.head_ref }} -e preview
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: public
path: public
deploy:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
needs: build
environment:
name: opensource.aoe.com
url: https://opensource.aoe.com/
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: public
path: public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: opensource.aoe.com
deploy-preview:
runs-on: ubuntu-20.04
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
needs: build
environment:
name: _preview-opensource/${{ github.head_ref }}
url: https://opensource.aoe.com/_preview-opensource/${{ github.head_ref }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: public
path: public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.PREVIEW_DEPLOY_KEY }}
external_repository: aoepeople/_preview-opensource
publish_branch: gh-pages
publish_dir: ./public
destination_dir: ${{ github.head_ref }}