1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 13:56:22 -04:00

simple test builds via GitHub Action

This commit is contained in:
Jake Jarvis 2019-12-04 11:25:42 -05:00
parent 96ad258d36
commit 1747bdd149
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
2 changed files with 48 additions and 6 deletions

41
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Build Hugo
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
lfs: false
- uses: actions/setup-node@v1
with:
node-version: "12.x"
# https://github.com/actions/cache/blob/master/examples.md#node---yarn
# https://github.com/actions/cache/issues/60
- name: Get yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --no-ignore-optional --frozen-lockfile
- run: yarn hugo:version
- run: yarn build:preview
- uses: actions/upload-artifact@master
if: github.event_name == 'pull_request'
with:
name: public
path: './public'

View File

@ -17,10 +17,12 @@
"build": "yarn clean && yarn hugo:build && yarn optimize", "build": "yarn clean && yarn hugo:build && yarn optimize",
"build:preview": "yarn clean && yarn hugo:build-dev", "build:preview": "yarn clean && yarn hugo:build-dev",
"hugo:build": "hugo --gc --cleanDestinationDir --verbose", "hugo:build": "hugo --gc --cleanDestinationDir --verbose",
"hugo:build-dev": "cross-env HUGO_ENV=development hugo -e development -b $DEPLOY_PRIME_URL --gc --cleanDestinationDir --buildDrafts --buildFuture --verbose", "hugo:build-dev": "cross-env HUGO_ENV=development hugo -e development --buildDrafts --buildFuture --baseURL ${DEPLOY_PRIME_URL:-/} --gc --cleanDestinationDir --verbose",
"hugo:serve": "hugo server --buildDrafts --buildFuture --renderToDisk --port 1313 --bind 0.0.0.0 --verbose", "hugo:version": "hugo version; hugo env",
"docker:serve": "docker build -t jarv.is:develop -f Dockerfile . && docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop", "start": "yarn serve:hugo",
"netlify:serve": "netlify dev --command 'yarn hugo:serve'", "serve:hugo": "hugo server --buildDrafts --buildFuture --port 1313 --bind 0.0.0.0 --verbose",
"serve:docker": "docker build -t jarv.is:develop -f Dockerfile . && docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop",
"serve:netlify": "netlify dev --command 'yarn serve:hugo'",
"optimize": "yarn optimize:html && yarn optimize:css && yarn optimize:img", "optimize": "yarn optimize:html && yarn optimize:css && yarn optimize:img",
"optimize:html": "html-minifier --html5 --collapse-whitespace --preserve-line-breaks --minify-css --file-ext html --input-dir public --output-dir public **/*.html", "optimize:html": "html-minifier --html5 --collapse-whitespace --preserve-line-breaks --minify-css --file-ext html --input-dir public --output-dir public **/*.html",
"optimize:css": "cleancss -O0 --format 'keep-breaks' -o public/style.css public/style.css", "optimize:css": "cleancss -O0 --format 'keep-breaks' -o public/style.css public/style.css",
@ -28,8 +30,7 @@
"lint": "yarn lint:markdown; yarn lint:sass", "lint": "yarn lint:markdown; yarn lint:sass",
"lint:markdown": "markdownlint content/notes/**/*.md", "lint:markdown": "markdownlint content/notes/**/*.md",
"lint:sass": "stylelint assets/sass/**/* --syntax scss", "lint:sass": "stylelint assets/sass/**/* --syntax scss",
"clean": "rimraf public/ resources/", "clean": "rimraf public/ resources/"
"test": "hugo version; hugo env"
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {