Merge pull request #19569 from dvdksn/fix-upstream-vendor

build: create makefile for vendoring
This commit is contained in:
David Karlsson 2024-03-06 14:19:10 +01:00 committed by GitHub
commit d947792271
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 3 deletions

View File

@ -49,8 +49,12 @@ ADD .htmltest.yml .htmltest.yml
RUN htmltest
FROM build-base as update-modules
ARG MODULE="-u"
RUN hugo mod get ${MODULE}
ARG MODULE
RUN if [ -n "$MODULE" ]; then \
hugo mod get ${MODULE}; \
else \
echo "no module set"; \
fi
RUN hugo mod vendor
FROM scratch as vendor

3
Makefile Normal file
View File

@ -0,0 +1,3 @@
.PHONY: vendor
vendor: ## vendor hugo modules
./scripts/vendor.sh

View File

@ -141,10 +141,14 @@ target "aws-cloudfront-update" {
output = ["type=cacheonly"]
}
variable "VENDOR_MODULE" {
default = null
}
target "vendor" {
target = "vendor"
args = {
MODULE = null
MODULE = VENDOR_MODULE
}
output = ["."]
}

16
scripts/vendor.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eu -o pipefail
output=$(mktemp -d -t hugo-vendor-output.XXXXXXXXXX)
function clean {
rm -rf "$output"
}
trap clean EXIT
docker buildx bake vendor \
"--set=*.output=type=local,dest=${output}"
rm -r _vendor
cp -R $output/* .