ci: set separate variable for container branch name

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-10-07 19:06:03 +02:00
parent 67b88595ad
commit 956382b682
3 changed files with 6 additions and 5 deletions

View File

@ -303,7 +303,7 @@ jobs:
with: with:
push: ${{ steps.ev.outputs.shouldBuild == 'true' }} push: ${{ steps.ev.outputs.shouldBuild == 'true' }}
tags: | tags: |
beryju.org/authentik/server:gh-${{ steps.ev.outputs.branchName }} beryju.org/authentik/server:gh-${{ steps.ev.outputs.branchNameContainer }}
beryju.org/authentik/server:gh-${{ steps.ev.outputs.branchName }}-${{ steps.ev.outputs.timestamp }}-${{ steps.ev.outputs.sha }} beryju.org/authentik/server:gh-${{ steps.ev.outputs.branchNameContainer }}-${{ steps.ev.outputs.timestamp }}-${{ steps.ev.outputs.sha }}
build-args: | build-args: |
GIT_BUILD_HASH=${{ steps.ev.outputs.sha }} GIT_BUILD_HASH=${{ steps.ev.outputs.sha }}

View File

@ -61,8 +61,8 @@ jobs:
with: with:
push: ${{ steps.ev.outputs.shouldBuild == 'true' }} push: ${{ steps.ev.outputs.shouldBuild == 'true' }}
tags: | tags: |
beryju.org/authentik/outpost-${{ matrix.type }}:gh-${{ steps.ev.outputs.branchName }} beryju.org/authentik/outpost-${{ matrix.type }}:gh-${{ steps.ev.outputs.branchNameContainer }}
beryju.org/authentik/outpost-${{ matrix.type }}:gh-${{ steps.ev.outputs.branchName }}-${{ steps.ev.outputs.timestamp }} beryju.org/authentik/outpost-${{ matrix.type }}:gh-${{ steps.ev.outputs.branchNameContainer }}-${{ steps.ev.outputs.timestamp }}
beryju.org/authentik/outpost-${{ matrix.type }}:gh-${{ steps.ev.outputs.sha }} beryju.org/authentik/outpost-${{ matrix.type }}:gh-${{ steps.ev.outputs.sha }}
file: ${{ matrix.type }}.Dockerfile file: ${{ matrix.type }}.Dockerfile
build-args: | build-args: |

View File

@ -9,11 +9,12 @@ sha = "GITHUB_SHA"
branch_name = os.environ[default_branch] branch_name = os.environ[default_branch]
if os.environ.get(env_pr_branch, "") != "": if os.environ.get(env_pr_branch, "") != "":
branch_name = os.environ[env_pr_branch] branch_name = os.environ[env_pr_branch]
branch_name = branch_name.replace("refs/heads/", "").replace("/", "-") branch_name = branch_name.replace("refs/heads/", "")
should_build = str(os.environ.get("DOCKER_USERNAME", "") != "").lower() should_build = str(os.environ.get("DOCKER_USERNAME", "") != "").lower()
print("##[set-output name=branchName]%s" % branch_name) print("##[set-output name=branchName]%s" % branch_name)
print("##[set-output name=branchNameContainer]%s" % branch_name.replace("/", "-"))
print("##[set-output name=timestamp]%s" % int(time())) print("##[set-output name=timestamp]%s" % int(time()))
print("##[set-output name=sha]%s" % os.environ[sha]) print("##[set-output name=sha]%s" % os.environ[sha])
print("##[set-output name=shouldBuild]%s" % should_build) print("##[set-output name=shouldBuild]%s" % should_build)