From 64e69691b8ab115e4df2276f123c381da9d62c65 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 9 Feb 2022 21:46:37 -0500 Subject: [PATCH] Load git repositories via a webhook --- .github/workflows/build-image.yml | 2 ++ Caddyfile | 43 +++++++++++++++++++++++++++++++ Containerfile | 4 ++- Makefile | 2 ++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index d1196ba..5ca56bb 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -9,6 +9,7 @@ env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} CADDY_VERSION: "2.4.6" + WEBHOOK_VERSION: "1.0.8" jobs: build-and-push-image: @@ -41,6 +42,7 @@ jobs: file: ./Containerfile build-args: | CADDY_VERSION=${{ env.CADDY_VERSION }} + WEBHOOK_VERSION=${{ env.WEBHOOK_VERSION }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Caddyfile b/Caddyfile index da0574b..5f19aa2 100644 --- a/Caddyfile +++ b/Caddyfile @@ -33,6 +33,49 @@ rewrite / /mpl-brochure-site/index.html rewrite @brochure /mpl-brochure-site{http.matchers.file.relative} + route /webhook { + webhook { + repo https://github.com/matplotlib/basemap.git + path {$SITE_DIR:sites}/basemap + branch gh-pages + } + webhook { + repo https://github.com/matplotlib/cheatsheets.git + path {$SITE_DIR:sites}/cheatsheets + branch gh-pages + } + webhook { + repo https://github.com/matplotlib/governance.git + path {$SITE_DIR:sites}/governance + branch gh-pages + } + webhook { + repo https://github.com/matplotlib/matplotblog.git + path {$SITE_DIR:sites}/matplotblog + branch gh-pages + } + webhook { + repo https://github.com/matplotlib/mpl-altair.git + path {$SITE_DIR:sites}/mpl-altair + branch gh-pages + } + webhook { + repo https://github.com/matplotlib/mpl-bench.git + path {$SITE_DIR:sites}/mpl-bench + branch gh-pages + } + webhook { + repo https://github.com/matplotlib/mpl-third-party.git + path {$SITE_DIR:sites}/mpl-third-party + branch gh-pages + } + webhook { + repo https://github.com/matplotlib/mpl-brochure-site.git + path {$SITE_DIR:sites}/mpl-brochure-site + branch gh-pages + } + } + # Finally try any of the versioned docs. handle { root * {$SITE_DIR:sites}/matplotlib.github.com diff --git a/Containerfile b/Containerfile index 203833e..a9ee7ed 100644 --- a/Containerfile +++ b/Containerfile @@ -1,7 +1,9 @@ ARG CADDY_VERSION=latest +ARG WEBHOOK_VERSION=latest FROM docker.io/library/caddy:${CADDY_VERSION}-builder AS builder -RUN xcaddy build +RUN xcaddy build \ + --with github.com/WingLim/caddy-webhook@${WEBHOOK_VERSION} FROM docker.io/library/caddy:${CADDY_VERSION} diff --git a/Makefile b/Makefile index a9124be..aafaad4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ RUNTIME ?= podman CADDY_IMAGE ?= caddy-mpl CADDY_VERSION ?= 2.4.6 +WEBHOOK_VERSION ?= 1.0.8 serve: mkdir -p sites @@ -15,6 +16,7 @@ serve: image: $(RUNTIME) build \ --build-arg=CADDY_VERSION=$(CADDY_VERSION) \ + --build-arg=WEBHOOK_VERSION=v$(WEBHOOK_VERSION) \ -t $(CADDY_IMAGE):$(CADDY_VERSION) \ -f Containerfile