ci: fix output of variables (#3810)

use print and correctly append

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens L 2022-10-18 23:53:31 +02:00 committed by GitHub
parent 167695d4b1
commit 4fc21c3cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 21 deletions

View File

@ -36,26 +36,23 @@ runs:
import os import os
from time import time 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 = configparser.ConfigParser()
parser.read(".bumpversion.cfg") 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 = parser.get("bumpversion", "current_version")
version_family = ".".join(version.split(".")[:-1]) version_family = ".".join(version.split(".")[:-1])
safe_branch_name = branch_name.replace("refs/heads/", "").replace("/", "-") safe_branch_name = branch_name.replace("refs/heads/", "").replace("/", "-")
with open(os.environ["GITHUB_OUTPUT"], "w+", encoding="utf-8") as _output: with open(os.environ["GITHUB_OUTPUT"], "a+", encoding="utf-8") as _output:
_output.write("branchName=%s" % branch_name) print("branchName=%s" % branch_name, file=_output)
_output.write("branchNameContainer=%s" % safe_branch_name) print("branchNameContainer=%s" % safe_branch_name, file=_output)
_output.write("timestamp=%s" % int(time())) print("timestamp=%s" % int(time()), file=_output)
_output.write("sha=%s" % os.environ[sha]) print("sha=%s" % os.environ["GITHUB_SHA"], file=_output)
_output.write("shouldBuild=%s" % should_build) print("shouldBuild=%s" % should_build, file=_output)
_output.write("version=%s" % version) print("version=%s" % version, file=_output)
_output.write("versionFamily=%s" % version_family) print("versionFamily=%s" % version_family, file=_output)

View File

@ -1,5 +1,5 @@
name: 'Setup authentik testing environemnt' name: 'Setup authentik testing environment'
description: 'Setup authentik testing environemnt' description: 'Setup authentik testing environment'
runs: runs:
using: "composite" using: "composite"

View File

@ -130,7 +130,7 @@ jobs:
- uses: testspace-com/setup-testspace@v1 - uses: testspace-com/setup-testspace@v1
with: with:
domain: ${{github.repository_owner}} domain: ${{github.repository_owner}}
- name: Setup authentik env - name: Setup e2e env (chrome, etc)
run: | run: |
docker-compose -f tests/e2e/docker-compose.yml up -d docker-compose -f tests/e2e/docker-compose.yml up -d
- id: cache-web - id: cache-web
@ -166,7 +166,7 @@ jobs:
- uses: testspace-com/setup-testspace@v1 - uses: testspace-com/setup-testspace@v1
with: with:
domain: ${{github.repository_owner}} domain: ${{github.repository_owner}}
- name: Setup authentik env - name: Setup e2e env (chrome, etc)
run: | run: |
docker-compose -f tests/e2e/docker-compose.yml up -d docker-compose -f tests/e2e/docker-compose.yml up -d
- id: cache-web - id: cache-web