Use a python builder for handling automated fetch of tag

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2023-02-24 21:58:20 +05:30
parent e24298f786
commit 190ee269d8
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
2 changed files with 13 additions and 2 deletions

View file

@ -2,6 +2,6 @@ docker-build:
stage: build
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" registry.baalajimaestro.me --password-stdin
- pip install --user -r requirements.txt
script:
- docker build . -t registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest
- docker push registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest
- python build.py

11
build.py Normal file
View file

@ -0,0 +1,11 @@
import subprocess
import os
from requests import get
import ujson
data = ujson.loads(get("https://api.github.com/repos/gohugoio/hugo/releases/latest").content)
tag = data["tag_name"][1:]
subprocess.run(["docker", "build", ".", "--build-arg", "HUGO_VERSION=" + tag, "-t", "registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest"])
subprocess.run(["docker", "push", "registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest"])