Skip to content

Commit

Permalink
Host main documentation on gh-pages, mixed with Helm Chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien Duportal authored and traefiker committed Sep 5, 2019
1 parent ea83590 commit 8c2d837
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ maesh
.vscode
vendor
integration/resources/compose/images
pages/
maesh-gh-pages*
*.zip
34 changes: 15 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:

script:
- echo "Skipping tests... (Tests are executed on SemaphoreCI)"
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then make -C ./docs docs; fi
- make docs-package

install:
- go mod tidy
Expand All @@ -37,14 +37,9 @@ install:

before_deploy:
# Install linters
- >
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin ${GOLANGCI_LINT_VERSION}
golangci-lint --version
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
export BEFORE_DEPLOY_RUN=1;
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
fi
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin ${GOLANGCI_LINT_VERSION}
- golangci-lint --version
- if ! [ "$BEFORE_DEPLOY_RUN" ]; then export BEFORE_DEPLOY_RUN=1; echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin; fi
deploy:
- provider: script
skip_cleanup: true
Expand All @@ -60,16 +55,17 @@ deploy:
condition: $STABLE = true
- provider: script
skip_cleanup: true
script: make helm-publish
script: make helm-package
on:
tags: true
condition: $STABLE = true
# - provider: pages
# edge: false
# github_token: ${GITHUB_TOKEN}
# target_branch: docs
# local_dir: docs/site
# skip_cleanup: true
# on:
# tag: true
# repo: containous/maesh
- provider: pages
edge: false
github_token: ${GITHUB_TOKEN}
target_branch: gh-pages
local_dir: pages
skip_cleanup: true
keep_history: true
on:
repo: containous/maesh
all_branches: true
38 changes: 23 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DIST_DIR_MAESH = $(DIST_DIR)/$(BINARY_NAME)
PROJECT ?= github.com/containous/$(BINARY_NAME)
GOLANGCI_LINTER_VERSION = v1.17.1

TAG_NAME := $(shell git tag -l --contains HEAD)
TAG_NAME ?= $(shell git tag -l --contains HEAD)
SHA := $(shell git rev-parse --short HEAD)
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%I:%M:%S%p')
Expand All @@ -26,7 +26,7 @@ $(DIST_DIR):
mkdir -p $(DIST_DIR)

clean:
rm -rf dist/ cover.out
rm -rf $(CURDIR)/dist/ cover.out $(CURDIR)/pages $(CURDIR)/gh-pages.zip $(CURDIR)/maesh-gh-pages

# Static linting of source files. See .golangci.toml for options
local-check: $(DIST_DIR) helm-lint
Expand Down Expand Up @@ -102,23 +102,31 @@ tidy:

helm:
@command -v helm >/dev/null 2>&1 || curl https://raw.githubusercontent.com/helm/helm/v2.14.1/scripts/get | bash
@helm init --client-only

helm-lint: helm
helm lint helm/chart/maesh

helm-publish: helm-lint
helm package --app-version $(TAG_NAME) $(DIST_DIR)/helm/chart/maesh
pages:
mkdir -p $(CURDIR)/pages
rm -rf $(CURDIR)/gh-pages.zip $(CURDIR)/maesh-gh-pages
curl -sSLO https://$(PROJECT)/archive/gh-pages.zip
unzip $(CURDIR)/gh-pages.zip
# We only keep the directory "charts" so documentation may remove files
cp -r $(CURDIR)/maesh-gh-pages/charts $(CURDIR)/pages/
rm -rf $(CURDIR)/gh-pages.zip $(CURDIR)/maesh-gh-pages

docs-package: pages
make -C $(CURDIR)/docs
cp -r $(CURDIR)/docs/site/* $(CURDIR)/pages/

helm-package: helm-lint pages
helm package --app-version $(TAG_NAME) $(CURDIR)/helm/chart/maesh
cp helm/chart/README.md index.md
git config user.email "traefiker@users.noreply.github.com"
git config user.name "traefiker"
git checkout gh-pages || (git checkout --orphan gh-pages && git rm -rf . > /dev/null)
mkdir -p charts
mv *.tgz index.md charts/
helm repo index charts/
git add charts/
git commit -m "[helm] Publishing helm charts: ${REVISION}"
git push origin gh-pages
mkdir -p $(CURDIR)/pages/charts
mv *.tgz index.md $(CURDIR)/pages/charts/
helm repo index $(CURDIR)/pages/charts/

.PHONY: local-check local-build local-test check build test push-docker \
vendor kubectl test-integration local-test-integration
.PHONY: helm helm-lint helm-publish
vendor kubectl test-integration local-test-integration pages
.PHONY: helm helm-lint helm-package

0 comments on commit 8c2d837

Please sign in to comment.