hugo-alpine-ext/build.py
baalajimaestro a48398ad3a
License under AGPL
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-02-24 22:01:31 +05:30

40 lines
767 B
Python

#
# Copyright © 2023 Maestro Creativescape
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
import subprocess
import os
from requests import get
import ujson
# Use github api and fetch the latest tag
data = ujson.loads(
get("https://api.github.com/repos/gohugoio/hugo/releases/latest").content
)
# Strip out the v letter
tag = data["tag_name"][1:]
# Build the image
subprocess.run(
[
"docker",
"build",
".",
"--build-arg",
"HUGO_VERSION=" + tag,
"-t",
"registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest",
]
)
# Push the newly built image
subprocess.run(
[
"docker",
"push",
"registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest",
]
)