From 1747bdd14951843fb648e94e3b9b3e3771ce2b44 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Wed, 4 Dec 2019 11:25:42 -0500 Subject: [PATCH] simple test builds via GitHub Action --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++++++++ package.json | 13 ++++++------ 2 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..b4465209 --- /dev/null +++ b/.github/workflows/build.yml @@ -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' diff --git a/package.json b/package.json index 08caa479..2004310d 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,12 @@ "build": "yarn clean && yarn hugo:build && yarn optimize", "build:preview": "yarn clean && yarn hugo:build-dev", "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:serve": "hugo server --buildDrafts --buildFuture --renderToDisk --port 1313 --bind 0.0.0.0 --verbose", - "docker:serve": "docker build -t jarv.is:develop -f Dockerfile . && docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop", - "netlify:serve": "netlify dev --command 'yarn hugo:serve'", + "hugo:build-dev": "cross-env HUGO_ENV=development hugo -e development --buildDrafts --buildFuture --baseURL ${DEPLOY_PRIME_URL:-/} --gc --cleanDestinationDir --verbose", + "hugo:version": "hugo version; hugo env", + "start": "yarn serve:hugo", + "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: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", @@ -28,8 +30,7 @@ "lint": "yarn lint:markdown; yarn lint:sass", "lint:markdown": "markdownlint content/notes/**/*.md", "lint:sass": "stylelint assets/sass/**/* --syntax scss", - "clean": "rimraf public/ resources/", - "test": "hugo version; hugo env" + "clean": "rimraf public/ resources/" }, "dependencies": {}, "devDependencies": {