-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add docs release versioning (#47)
- Loading branch information
1 parent
1af2df2
commit 3eb081e
Showing
5 changed files
with
84 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,4 @@ jobs: | |
run: make docs-build | ||
- name: Deploy Docs | ||
run: make docs-deploy | ||
# - run: mkdocs gh-deploy --force | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,66 @@ | ||
docs-build: | ||
docker build -t squidfunk/mkdocs-material ./docs/ | ||
|
||
docs-local-docker: | ||
docker build -t squidfunk/mkdocs-material ./docs/ | ||
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material serve -a 0.0.0.0:8000 | ||
|
||
docs-deploy: | ||
pip install -r ./docs/requirements.txt | ||
mike set-default $(git rev-parse --short HEAD) | ||
mike deploy --push --update-aliases | ||
.PHONY: help docs-build docs-local-docker docs-deploy | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
########################################################### | ||
# ENVIRONMENT VARIABLES | ||
# Define the environment variables | ||
########################################################### | ||
ifeq ($(GITHUB_ACTIONS),true) | ||
GIT_USER_NAME := github-actions[bot] | ||
GIT_USER_EMAIL := "41898282+github-actions[bot]@users.noreply.github.com" | ||
else | ||
GIT_USER_NAME := $(shell git config user.name) | ||
GIT_USER_EMAIL := $(shell git config user.email) | ||
endif | ||
|
||
########################################################### | ||
# COLOR CONFIGURATION | ||
# Check if the terminal supports color, define color codes | ||
########################################################### | ||
COLOR_SUPPORT := $(shell tput colors 2>/dev/null) | ||
# Define color codes if the terminal supports color | ||
ifdef COLOR_SUPPORT | ||
ifneq ($(shell tput colors),-1) | ||
RED := $(shell tput setaf 1) | ||
GREEN := $(shell tput setaf 2) | ||
CYAN := $(shell tput setaf 6) | ||
RESET := $(shell tput sgr0) | ||
endif | ||
endif | ||
|
||
########################################################### | ||
# docs-build | ||
# Build the docs using docker | ||
########################################################### | ||
docs-build: ## Build the docs using docker | ||
@if [ -z "${VERSION}" ]; then echo -e "${RED}VERSION is not set. Run 'make help' for usage. ${RESET}"; exit 1; fi | ||
@echo -e "Docs version is: ${GREEN}$(VERSION)${RESET}" | ||
docker build -f ./docs/Dockerfile -t docs:$(VERSION) . --build-arg GIT_USER_NAME="$(GIT_USER_NAME)" --build-arg GIT_USER_EMAIL="$(GIT_USER_EMAIL)" --build-arg GITHUB_ACTIONS=$(GITHUB_ACTIONS) --no-cache | ||
|
||
########################################################### | ||
# docs-deploy | ||
# Deploy the docs using 'mike' | ||
########################################################### | ||
docs-deploy: ## Deploy the docs using 'mike' | ||
@if [ -z "${VERSION}" ]; then echo -e "${RED}VERSION is not set. Run 'make help' for usage. ${RESET}"; exit 1; fi | ||
@echo -e "Docs version is: ${GREEN}$(VERSION)${RESET}" | ||
docker run -t docs:$(VERSION) mike deploy --push --update-aliases $(VERSION) latest | ||
|
||
########################################################### | ||
# docs-local-docker | ||
# Build and run the docs locally using docker and 'serve' | ||
########################################################### | ||
docs-local-docker: ## Build and run the docs locally using docker and 'serve' | ||
@if [ -z "${VERSION}" ]; then echo -e "${RED}VERSION is not set. Run 'make help' for usage. ${RESET}"; exit 1; fi | ||
@echo -e "Docs version is: ${GREEN}$(VERSION)${RESET}" | ||
docker build -f ./docs/Dockerfile -t docs:$(VERSION) . --build-arg GIT_USER_NAME="$(GIT_USER_NAME)" --build-arg GIT_USER_EMAIL="$(GIT_USER_EMAIL)" --build-arg GITHUB_ACTIONS=$(GITHUB_ACTIONS) --no-cache | ||
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs docs:$(VERSION) mkdocs serve --dev-addr=0.0.0.0:8000 | ||
|
||
########################################################### | ||
# help | ||
# Display this help | ||
########################################################### | ||
help: ## Display this help | ||
@echo -e "Usage: make [TARGET] VERSION=<version>\n" | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "${CYAN}%-30s${RESET} %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
FROM squidfunk/mkdocs-material | ||
COPY ./requirements.txt requirements.txt | ||
# Set PIP_USER to "no" to suppress warnings. Fine to run as root for local mkdocs development server. | ||
ENV PIP_USER=no | ||
RUN pip install -r requirements.txt | ||
FROM python:3.12 | ||
WORKDIR /build | ||
COPY . . | ||
ARG GIT_USER_NAME GIT_USER_EMAIL GITHUB_ACTIONS | ||
ENV GIT_USER_NAME=$GIT_USER_NAME GIT_USER_EMAIL=$GIT_USER_EMAIL GITHUB_ACTIONS=$GITHUB_ACTIONS | ||
|
||
RUN git config --global user.name "$GIT_USER_NAME" && git config --global user.email "$GIT_USER_EMAIL" | ||
#RUN git config --global --add safe.directory /build | ||
RUN pip install -r ./docs/requirements.txt --no-cache-dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,5 +81,6 @@ extra: | |
version: | ||
provider: mike | ||
default: latest | ||
alias: true | ||
|
||
copyright: Copyright © 2024 Amazon Web Services |