added publish and local run commands

master
Adam Veldhousen 4 years ago
parent 85778d763a
commit 763af607c1
Signed by: adam
GPG Key ID: 6DB29003C6DD1E4B

@ -29,6 +29,7 @@ p {
} }
#header { #header {
margin-bottom: 20px;
grid-column-start: 1; grid-column-start: 1;
grid-column-end: 3; grid-column-end: 3;
} }

@ -13,7 +13,7 @@ across your entire machine.
## Automatically lint and test on commit ## Automatically lint and test on commit
One of my favorite hooks is a `~/.githooks/pre-commit` hook that auto runs test and lint commands from a `makefile` or One of my favorite hooks is the `~/.githooks/pre-commit` hook that auto runs test and lint commands from a `makefile` or
`package.json` if they're found: `package.json` if they're found:
```sh ```sh
@ -38,6 +38,8 @@ fi
{{</highlight>}} {{</highlight>}}
``` ```
The `/usr/bin/env bash` piece ensures that the script has access to all of the environment variables you expect in your
regular shell.
If the test or lint command fails then the `git commit` command fails. If I absolutely need to commit something in spite If the test or lint command fails then the `git commit` command fails. If I absolutely need to commit something in spite
of the lint/test results I can do `git commit --no-verify` to skip the `pre-commit` hook. of the lint/test results I can do `git commit --no-verify` to skip the `pre-commit` hook.

@ -1,17 +1,31 @@
.PHONY: docker-build-dev serve write VERSION := $(shell git rev-parse --abbrev-ref HEAD)
.PHONY: clean docker-build-dev serve write
write: serve write: serve
new-post: build: public
./hugo new posts/$${TITLE:new_post}.md docker build -t vdhsn/blog:${VERSION} -f Dockerfile .
hugo: publish: build
go get -u --tags extended -v github.com/gohugoio/hugo docker push vdhsn/blog:${VERSION}
go install --tags extended -v github.com/gohugoio/hugo
test-publish: build
docker run -it -p 8080:80 vdhsn/blog:${VERSION}
new-post:
@./hugo new posts/$${TITLE:new_post}.md
docker-build-dev: docker-build-dev:
docker build --build-arg='VERSION=0.59.1' -t hugo -f Dockerfile.dev . @docker build --build-arg='VERSION=0.59.1' -t hugo -f Dockerfile.dev .
serve: serve:
./hugo server -D -w --bind 0.0.0.0 ./hugo server -D --log -w --bind 0.0.0.0
clean:
@rm -rf ./public ./resources
hugo:
@go get -u --tags extended -v github.com/gohugoio/hugo
public:
./hugo --minify --gc

Loading…
Cancel
Save