40 lines
767 B
Python
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",
|
|
]
|
|
)
|