2022-04-04 12:02:10 +00:00
|
|
|
name: 'Prepare docker environment variables'
|
|
|
|
description: 'Prepare docker environment variables'
|
|
|
|
|
|
|
|
outputs:
|
|
|
|
shouldBuild:
|
|
|
|
description: "Whether to build image or not"
|
|
|
|
value: ${{ steps.ev.outputs.shouldBuild }}
|
|
|
|
branchName:
|
|
|
|
description: "Branch name"
|
|
|
|
value: ${{ steps.ev.outputs.branchName }}
|
|
|
|
branchNameContainer:
|
|
|
|
description: "Branch name (for containers)"
|
|
|
|
value: ${{ steps.ev.outputs.branchNameContainer }}
|
|
|
|
timestamp:
|
|
|
|
description: "Timestamp"
|
|
|
|
value: ${{ steps.ev.outputs.timestamp }}
|
|
|
|
sha:
|
|
|
|
description: "sha"
|
|
|
|
value: ${{ steps.ev.outputs.sha }}
|
2022-06-21 21:31:27 +00:00
|
|
|
version:
|
|
|
|
description: "version"
|
|
|
|
value: ${{ steps.ev.outputs.version }}
|
|
|
|
versionFamily:
|
|
|
|
description: "versionFamily"
|
|
|
|
value: ${{ steps.ev.outputs.versionFamily }}
|
2022-04-04 12:02:10 +00:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Generate config
|
|
|
|
id: ev
|
|
|
|
shell: python
|
|
|
|
run: |
|
|
|
|
"""Helper script to get the actual branch name, docker safe"""
|
2022-10-16 13:43:53 +00:00
|
|
|
import configparser
|
2022-04-04 12:02:10 +00:00
|
|
|
import os
|
|
|
|
from time import time
|
|
|
|
|
2022-10-18 21:53:31 +00:00
|
|
|
parser = configparser.ConfigParser()
|
|
|
|
parser.read(".bumpversion.cfg")
|
2022-04-04 12:02:10 +00:00
|
|
|
|
2022-10-18 21:53:31 +00:00
|
|
|
branch_name = os.environ["GITHUB_REF"]
|
|
|
|
if os.environ.get("GITHUB_HEAD_REF", "") != "":
|
|
|
|
branch_name = os.environ["GITHUB_HEAD_REF"]
|
2022-04-04 12:02:10 +00:00
|
|
|
|
|
|
|
should_build = str(os.environ.get("DOCKER_USERNAME", "") != "").lower()
|
2022-06-21 21:31:27 +00:00
|
|
|
version = parser.get("bumpversion", "current_version")
|
|
|
|
version_family = ".".join(version.split(".")[:-1])
|
2022-10-16 13:43:53 +00:00
|
|
|
safe_branch_name = branch_name.replace("refs/heads/", "").replace("/", "-")
|
|
|
|
|
2022-10-18 21:53:31 +00:00
|
|
|
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)
|