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

multiple doc version #353

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .dockerignore

This file was deleted.

44 changes: 41 additions & 3 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,54 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install packages
run: |
git config --global url."https://${{ secrets.MKDOCS_INSIDERS_TOKEN }}@github".insteadOf https://github
pip install git+https://github.com/squidfunk/mkdocs-material-insiders.git mkdocs-redirects mike

- name: Configure git credentials
run: |
git config --global user.name 'TriggerMesh Bot'
git config --global user.email 'bot@triggermesh.com'

- name: Configure DOCS_VERSION
id: docs-version
run: |
[[ "${GITHUB_REF_TYPE}" == "tag" ]] && DOCS_VERSION=${GITHUB_REF_NAME:1}
echo "DOCS_VERSION=${DOCS_VERSION:-DEV}" >> $GITHUB_OUTPUT

- name: Deploy version and push
run: |
DOCS_VERSION="${{ steps.docs-version.outputs.DOCS_VERSION }}"
if [[ "${DOCS_VERSION}" != "DEV" ]]; then
mike deploy ${DOCS_VERSION} latest --update-aliases --push
else
mike deploy ${DOCS_VERSION}
fi

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to GCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCLOUD_SERVICEACCOUNT_KEY }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
Expand All @@ -57,12 +93,14 @@ jobs:
tags: |
type=semver,pattern={{raw}}
type=sha
- name: Build image and push to container registries

- name: Switch to gh-pages branch
run: git checkout gh-pages

- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
build-args: |
MKDOCS_INSIDERS_TOKEN=${{ secrets.MKDOCS_INSIDERS_TOKEN }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
.DS_Store
/.idea/
/.vscode/
.envrc

# Build artifacts
**/_output
/site/
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ IMAGE_SHA ?= $(shell git rev-parse HEAD)

HAS_MKDOCS := $(shell command -v mkdocs;)

.PHONY: help build image cloudbuild-test cloudbuild clean
.PHONY: help build cloudbuild-test cloudbuild clean

all: build

install-mkdocs:
ifndef HAS_MKDOCS
pip3 install mkdocs-material mkdocs-redirects
pip3 install mkdocs-material mkdocs-redirects mike
endif

help: ## Display this help
Expand All @@ -36,9 +36,6 @@ release: ## Build distribution tarball
@mkdir -p $(DIST_DIR)
tar -jcf $(DIST_DIR)/$(PACKAGE)-$(VERSION).tar.bz2 -C $$(dirname $(SITE_OUTPUT_DIR)) $$(basename $(SITE_OUTPUT_DIR))

image: ## Builds the container image
$(DOCKER) build -t $(IMAGE_REPO)/$(PACKAGE) -f Dockerfile .

clean: ## Clean build artifacts
@$(RM) -v $(DIST_DIR)/$(PACKAGE)-$(VERSION).tar.bz2
@$(RM) -rv $(SITE_OUTPUT_DIR)
9 changes: 9 additions & 0 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@
<strong>Twitter</strong>
</a>
{% endblock %}

{% block outdated %}
You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}">


<strong>Click here to go to latest.</strong>
</a>
{% endblock %}
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ theme:
- navigation.tracking

extra:
version:
provider: mike
social:
- icon: fontawesome/brands/github
link: https://github.com/triggermesh
Expand Down