From 38d4f4b7c1587e090adfc2aab5fcb0bb5c6d9ed4 Mon Sep 17 00:00:00 2001 From: Jennings Zhang Date: Fri, 27 Oct 2023 07:39:57 -0400 Subject: [PATCH] Fix dock_image --- .github/workflows/ci.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a89d492..d961a8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,11 @@ jobs: run: | import os import itertools - + + def join_tag(t): + registry, repo, tag = t + return f'{registry}/{repo}:{tag}'.lower() + registries = ['docker.io', 'ghcr.io'] repos = ['${{ github.repository }}'] if '${{ github.ref_type }}' == 'branch': @@ -63,16 +67,17 @@ jobs: else: tags = [] - def join_tag(t): - registry, repo, tag = t - return f'{registry}/{repo}:{tag}'.lower() + if '${{ github.ref_type }}' == 'tag': + local_tag = join_tag(('ghcr.io', '${{ github.repository }}', version)) + else: + local_tag = join_tag(('localhost', '${{ github.repository }}', 'latest')) product = itertools.product(registries, repos, tags) tags_csv = ','.join(map(join_tag, product)) outputs = { 'tags_csv' : tags_csv, 'push' : 'true' if tags_csv else 'false', - 'local_tag': join_tag(('localhost', '${{ github.repository }}', 'latest')) + 'local_tag': local_tag } with open(os.environ['GITHUB_OUTPUT'], 'a') as out: for k, v in outputs.items():