task: run ci on PRs

This commit is contained in:
Sören Weber 2021-10-19 17:24:41 +02:00
parent 0d3c097f8c
commit 7192d9db2b
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 11 additions and 28 deletions

View file

@ -1,17 +1,16 @@
name: Deploy GitHub Pages name: Deploy GitHub Pages
on: on:
push: push: # Build on all pushes but only deploy for main branch
branches: pull_request: # Build on all PRs regardless what branch
- main # Set a branch to deploy workflow_dispatch: # Allow this task to be manually started (you'll never know)
pull_request:
workflow_dispatch:
jobs: jobs:
deploy: ci:
runs-on: ubuntu-20.04 name: Run CI
runs-on: ubuntu-latest
steps: steps:
- name: Checkout Site - name: Checkout site
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: true # Fetch Hugo themes (true OR recursive) submodules: true # Fetch Hugo themes (true OR recursive)
@ -23,12 +22,12 @@ jobs:
hugo-version: 'latest' hugo-version: 'latest'
# extended: true # extended: true
- name: Build Site - name: Build site
run: hugo --minify --source exampleSite --destination ../public --baseURL https://mcshelby.github.io/hugo-theme-relearn/ run: hugo --minify --source exampleSite --destination ../public --cleanDestinationDir --gc --baseURL https://mcshelby.github.io/hugo-theme-relearn/
- name: Deploy Site - name: Deploy site
if: github.event_name == 'workflow_dispatch' or (github.event_name == 'push' and github.ref == 'refs/heads/main')
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public publish_dir: ./public

View file

@ -1,16 +0,0 @@
box: golang
build:
steps:
# Gets the dependencies
- script:
name: get hugo
code: |
git clone https://github.com/gohugoio/hugo.git && cd hugo && go install
# Sets the go workspace and places you package
# at the right place in the workspace tree
- setup-go-workspace
# Build the project
- script:
name: build site
code: |
cd exampleSite && hugo