added publish and local run commands
parent
85778d763a
commit
763af607c1
|
|
@ -29,6 +29,7 @@ p {
|
|||
}
|
||||
|
||||
#header {
|
||||
margin-bottom: 20px;
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ across your entire machine.
|
|||
|
||||
## 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:
|
||||
|
||||
```sh
|
||||
|
|
@ -38,6 +38,8 @@ fi
|
|||
{{</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
|
||||
of the lint/test results I can do `git commit --no-verify` to skip the `pre-commit` hook.
|
||||
|
|
|
|||
30
makefile
30
makefile
|
|
@ -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
|
||||
|
||||
new-post:
|
||||
./hugo new posts/$${TITLE:new_post}.md
|
||||
build: public
|
||||
docker build -t vdhsn/blog:${VERSION} -f Dockerfile .
|
||||
|
||||
hugo:
|
||||
go get -u --tags extended -v github.com/gohugoio/hugo
|
||||
go install --tags extended -v github.com/gohugoio/hugo
|
||||
publish: build
|
||||
docker push vdhsn/blog:${VERSION}
|
||||
|
||||
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 --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:
|
||||
./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…
Reference in New Issue