Skip to content

Commit

Permalink
Add support of tag-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 18, 2024
1 parent 94f0dde commit cbceb45
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .github/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/camptocamp/tag-publish/0.8.2/c2cciutils/schema.json

docker:
repository:
github:
server: ghcr.io
versions:
- version_tag
- version_branch
- rebuild
images:
- name: camptocamp/github-app-geo-project
10 changes: 3 additions & 7 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ on:
- '*'
pull_request:

permissions:
contents: write

env:
HAS_SECRETS: ${{ secrets.HAS_SECRETS }}
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring

jobs:
main:
Expand All @@ -26,12 +28,6 @@ jobs:
with:
fetch-depth: 0

- uses: camptocamp/initialise-gopass-summon-action@v2
with:
ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}}
github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}}
patterns: pypi docker

# Use Python 3.11
- uses: actions/setup-python@v5
with:
Expand Down
10 changes: 8 additions & 2 deletions github_app_geo_project/module/versions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit cbceb45

Please sign in to comment.