From 4fc21c3cc3cc17e1dbf7b45e06495a52b8a5030e Mon Sep 17 00:00:00 2001 From: Jens L Date: Tue, 18 Oct 2022 23:53:31 +0200 Subject: [PATCH] ci: fix output of variables (#3810) use print and correctly append Signed-off-by: Jens Langhammer Signed-off-by: Jens Langhammer --- .../actions/docker-push-variables/action.yml | 31 +++++++++---------- .github/actions/setup/action.yml | 4 +-- .github/workflows/ci-main.yml | 4 +-- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/actions/docker-push-variables/action.yml b/.github/actions/docker-push-variables/action.yml index f050c2326..98d0b20cb 100644 --- a/.github/actions/docker-push-variables/action.yml +++ b/.github/actions/docker-push-variables/action.yml @@ -36,26 +36,23 @@ runs: import os from time import time - env_pr_branch = "GITHUB_HEAD_REF" - default_branch = "GITHUB_REF" - sha = "GITHUB_SHA" - - branch_name = os.environ[default_branch] - if os.environ.get(env_pr_branch, "") != "": - branch_name = os.environ[env_pr_branch] - - should_build = str(os.environ.get("DOCKER_USERNAME", "") != "").lower() parser = configparser.ConfigParser() parser.read(".bumpversion.cfg") + + branch_name = os.environ["GITHUB_REF"] + if os.environ.get("GITHUB_HEAD_REF", "") != "": + branch_name = os.environ["GITHUB_HEAD_REF"] + + should_build = str(os.environ.get("DOCKER_USERNAME", "") != "").lower() version = parser.get("bumpversion", "current_version") version_family = ".".join(version.split(".")[:-1]) safe_branch_name = branch_name.replace("refs/heads/", "").replace("/", "-") - with open(os.environ["GITHUB_OUTPUT"], "w+", encoding="utf-8") as _output: - _output.write("branchName=%s" % branch_name) - _output.write("branchNameContainer=%s" % safe_branch_name) - _output.write("timestamp=%s" % int(time())) - _output.write("sha=%s" % os.environ[sha]) - _output.write("shouldBuild=%s" % should_build) - _output.write("version=%s" % version) - _output.write("versionFamily=%s" % version_family) + with open(os.environ["GITHUB_OUTPUT"], "a+", encoding="utf-8") as _output: + print("branchName=%s" % branch_name, file=_output) + print("branchNameContainer=%s" % safe_branch_name, file=_output) + print("timestamp=%s" % int(time()), file=_output) + print("sha=%s" % os.environ["GITHUB_SHA"], file=_output) + print("shouldBuild=%s" % should_build, file=_output) + print("version=%s" % version, file=_output) + print("versionFamily=%s" % version_family, file=_output) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index e6ea0e797..f44691115 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,5 +1,5 @@ -name: 'Setup authentik testing environemnt' -description: 'Setup authentik testing environemnt' +name: 'Setup authentik testing environment' +description: 'Setup authentik testing environment' runs: using: "composite" diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index bd9a54f3c..0f9862be6 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -130,7 +130,7 @@ jobs: - uses: testspace-com/setup-testspace@v1 with: domain: ${{github.repository_owner}} - - name: Setup authentik env + - name: Setup e2e env (chrome, etc) run: | docker-compose -f tests/e2e/docker-compose.yml up -d - id: cache-web @@ -166,7 +166,7 @@ jobs: - uses: testspace-com/setup-testspace@v1 with: domain: ${{github.repository_owner}} - - name: Setup authentik env + - name: Setup e2e env (chrome, etc) run: | docker-compose -f tests/e2e/docker-compose.yml up -d - id: cache-web