From a2b060ed9df9f0e921f19d81ccafe028ddf88a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Fri, 15 Nov 2024 18:40:11 +0100 Subject: [PATCH] Add support of tag-publish --- .github/workflows/main.yaml | 3 +++ github_app_geo_project/module/versions/__init__.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index eb86651419..fb529b89d3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -9,6 +9,9 @@ on: - '*' pull_request: +permissions: + contents: read + env: HAS_SECRETS: ${{ secrets.HAS_SECRETS }} PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring diff --git a/github_app_geo_project/module/versions/__init__.py b/github_app_geo_project/module/versions/__init__.py index 41b87a70c7..11c6ad034c 100644 --- a/github_app_geo_project/module/versions/__init__.py +++ b/github_app_geo_project/module/versions/__init__.py @@ -16,6 +16,7 @@ import github import requests import security_md +import yaml from pydantic import BaseModel from github_app_geo_project import module, utils @@ -459,8 +460,13 @@ def _get_names( if match and match.group(1) not in names: names.append(match.group(1)) os.environ["GITHUB_REPOSITORY"] = f"{context.github_project.owner}/{context.github_project.repository}" - data = c2cciutils.get_config() - docker_config = data.get("publish", {}).get("docker", {}) + docker_config = {} + if os.path.exists(".github/publish.yaml"): + with open(".github/publish.yaml", encoding="utf-8") as file: + docker_config = yaml.load(file, Loader=yaml.SafeLoader).get("docker", {}) + else: + data = c2cciutils.get_config() + docker_config = data.get("publish", {}).get("docker", {}) if docker_config: names = names_by_datasource.setdefault("docker", _TransversalStatusNameByDatasource()).names all_versions = [version]