From ccd72344cc118a5236a61f5f072488e458b06b33 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 5 Dec 2017 21:59:57 -0200 Subject: [PATCH] chore: automating docs deployment Auto-deploy docs on releases. Should test it first, though. --- .travis.yml | 2 +- Makefile | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e03579e93..6c1ed0abc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,6 @@ script: after_success: - bash <(curl -s https://codecov.io/bash) - test -n "$TRAVIS_TAG" && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" - - test -n "$TRAVIS_TAG" && go run main.go + - test -n "$TRAVIS_TAG" && go run main.go && make static-push notifications: email: false diff --git a/Makefile b/Makefile index b08a8643b..00a57eeb7 100644 --- a/Makefile +++ b/Makefile @@ -11,42 +11,54 @@ setup: go get -u github.com/apex/static/cmd/static-docs dep ensure gometalinter --install +.PHONY: setup # Run all the tests test: gotestcover $(TEST_OPTIONS) -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m +.PHONY: cover # Run all the tests and opens the coverage report cover: test go tool cover -html=coverage.txt +.PHONY: cover # gofmt and goimports all go files fmt: find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done +.PHONY: fmt # Run all the linters lint: gometalinter --vendor ./... +.PHONY: lint # Run all the tests and code checks ci: test lint +.PHONY: ci # Build a beta version of goreleaser build: go build - -HIGHLIGHT=https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0 +.PHONY: build # Generate the static documentation static: - @rm -rf ../goreleaser.github.io/theme + @rm -rf dist/goreleaser.github.io + @mkdir -p dist + @git clone git@github.com:goreleaser/goreleaser.github.io.git dist/goreleaser.github.io + @rm -rf dist/goreleaser.github.io/theme @static-docs \ --in docs \ - --out ../goreleaser.github.io \ + --out dist/goreleaser.github.io \ --title GoReleaser \ --subtitle "Deliver Go binaries as fast and easily as possible" \ --google UA-106198408-1 - @cd ../goreleaser.github.io && git add -A && git commit -am 'bump: docs' && git push origin master +.PHONY: static + +static-push: static + @cd dist/goreleaser.github.io && git add -A && git commit -am 'bump: docs' && git diff --exit-code origin/master..master > /dev/null || git push origin master +.PHONY: static-push # Show to-do items per file. todo: