hugo-theme-relearn/.github/workflows/cicd.yaml
2021-10-22 01:15:54 +02:00

33 lines
1.1 KiB
YAML

name: CI/CD
on:
push: # Build on all pushes but only deploy for main branch
pull_request: # Build on all PRs regardless what branch
workflow_dispatch: # Allow this task to be manually started (you'll never know)
jobs:
ci:
name: Run CI/CD
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
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 site
run: hugo --minify --source exampleSite --destination ../public --cleanDestinationDir --gc --baseURL https://mcshelby.github.io/hugo-theme-relearn/
- name: Deploy site
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public