From 956382b682290de7c471608d6e90aa18780d4637 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 7 Oct 2021 19:06:03 +0200 Subject: [PATCH] ci: set separate variable for container branch name Signed-off-by: Jens Langhammer --- .github/workflows/ci-main.yml | 4 ++-- .github/workflows/ci-outpost.yml | 4 ++-- scripts/gh_do_set_branch.py | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 64c4a6163..58a52eddb 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -303,7 +303,7 @@ jobs: with: push: ${{ steps.ev.outputs.shouldBuild == 'true' }} tags: | - beryju.org/authentik/server:gh-${{ steps.ev.outputs.branchName }} - 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 }} + beryju.org/authentik/server:gh-${{ steps.ev.outputs.branchNameContainer }}-${{ steps.ev.outputs.timestamp }}-${{ steps.ev.outputs.sha }} build-args: | GIT_BUILD_HASH=${{ steps.ev.outputs.sha }} diff --git a/.github/workflows/ci-outpost.yml b/.github/workflows/ci-outpost.yml index 6f3785794..eee234924 100644 --- a/.github/workflows/ci-outpost.yml +++ b/.github/workflows/ci-outpost.yml @@ -61,8 +61,8 @@ jobs: with: push: ${{ steps.ev.outputs.shouldBuild == 'true' }} tags: | - beryju.org/authentik/outpost-${{ matrix.type }}:gh-${{ steps.ev.outputs.branchName }} - 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 }} + 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 }} file: ${{ matrix.type }}.Dockerfile build-args: | diff --git a/scripts/gh_do_set_branch.py b/scripts/gh_do_set_branch.py index efb41e67c..e0adbcaeb 100644 --- a/scripts/gh_do_set_branch.py +++ b/scripts/gh_do_set_branch.py @@ -9,11 +9,12 @@ sha = "GITHUB_SHA" branch_name = os.environ[default_branch] if os.environ.get(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() 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=sha]%s" % os.environ[sha]) print("##[set-output name=shouldBuild]%s" % should_build)