Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 6b68eb0

Browse files
author
Sameer Naik
committed
add makefile
1 parent f01a7ce commit 6b68eb0

File tree

3 files changed

+70
-5
lines changed

3 files changed

+70
-5
lines changed

.dockerignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Top level files and directories
22
/.circleci/
3-
/.git/
43
/.dockerignore
54
/.gcloudignore
5+
/.git/
6+
/_output/
67
/cloudbuild.yaml
7-
/site
88
/Dockerfile

.gitignore

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1-
/site
2-
/.venv
3-
**/.DS_Store
1+
# Local configurations and secrets
2+
/.env/
3+
/.local/
4+
5+
# Continuous integration
6+
7+
# Editors and IDEs
8+
*.swo
9+
*.swp
10+
*~
11+
/*.sublime-project
12+
/*.sublime-workspace
13+
/.DS_Store
14+
/.idea/
15+
/.vscode/
16+
17+
# Build artifacts
18+
**/_output

Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
PACKAGE = docs
2+
PACKAGE_DESC = Triggermesh Docs
3+
VERSION ?= $(shell git describe --tags --always)
4+
5+
BASE_DIR ?= $(CURDIR)
6+
7+
OUTPUT_DIR ?= $(BASE_DIR)/_output
8+
DIST_DIR ?= $(OUTPUT_DIR)
9+
10+
SITE_OUTPUT_DIR ?= $(OUTPUT_DIR)/site
11+
12+
DOCKER ?= docker
13+
14+
IMAGE_REPO ?= gcr.io/triggermesh
15+
IMAGE_TAG ?= latest
16+
IMAGE_SHA ?= $(shell git rev-parse HEAD)
17+
18+
HAS_MKDOCS := $(shell command -v mkdocs;)
19+
20+
.PHONY: help build image cloudbuild-test cloudbuild clean
21+
22+
all: build
23+
24+
install-mkdocs:
25+
ifndef HAS_MKDOCS
26+
pip3 install mkdocs
27+
endif
28+
29+
help: ## Display this help
30+
@awk 'BEGIN {FS = ":.*?## "; printf "\n$(PACKAGE_DESC)\n\nUsage:\n make \033[36m<source>\033[0m\n"} /^[a-zA-Z0-9._-]+:.*?## / {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
31+
32+
build: install-mkdocs ## Build the docs
33+
mkdocs build --clean --config-file mkdocs.yml --site-dir $(SITE_OUTPUT_DIR)
34+
35+
release: ## Build distribution tarball
36+
@mkdir -p $(DIST_DIR)
37+
tar -jcf $(DIST_DIR)/$(PACKAGE)-$(VERSION).tar.bz2 -C $$(dirname $(SITE_OUTPUT_DIR)) $$(basename $(SITE_OUTPUT_DIR))
38+
39+
image: ## Builds the container image
40+
$(DOCKER) build -t $(IMAGE_REPO)/$(PACKAGE) -f Dockerfile .
41+
42+
cloudbuild-test: ## Test container image build with Google Cloud Build
43+
gcloud builds submit $(BASE_DIR) --config cloudbuild.yaml --substitutions COMMIT_SHA=${IMAGE_SHA},_KANIKO_IMAGE_TAG=_
44+
45+
cloudbuild: ## Build and publish image to GCR
46+
gcloud builds submit $(BASE_DIR) --config cloudbuild.yaml --substitutions COMMIT_SHA=${IMAGE_SHA},_KANIKO_IMAGE_TAG=${IMAGE_TAG}
47+
48+
clean: ## Clean build artifacts
49+
@$(RM) -v $(DIST_DIR)/$(PACKAGE)-$(VERSION).tar.bz2
50+
@$(RM) -rv $(SITE_OUTPUT_DIR)

0 commit comments

Comments
 (0)