This commit is contained in:
Yoshino-s
2023-06-06 12:26:01 +08:00
commit e1d95edc2c
8 changed files with 962 additions and 0 deletions

23
update.py Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python3
import re
from dxf import DXF
from os import environ
dxf = DXF('ghcr.io', "coder/coder")
dxf.authenticate(actions=["pull"])
tags = dxf.list_aliases()
tags = [tag for tag in tags if re.match(r"^v\d+\.\d+\.\d+$", tag)]
try:
local_dxf = DXF(environ['CI_REGISTRY'], environ['CI_PROJECT_PATH'])
local_dxf.authenticate(
environ['CI_REGISTRY_USER'], environ['CI_REGISTRY_PASSWORD'], actions=["pull"])
local_tags = local_dxf.list_aliases()
except:
local_tags = []
update_tags = set(tags) - set(local_tags)
update_tags.add('latest')
print(' '.join(update_tags))