ci: fix gh_env

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-10-07 20:20:59 +02:00
parent f32d35b07c
commit f9a180eb1f
3 changed files with 4 additions and 5 deletions

View File

@ -152,7 +152,7 @@ jobs:
- name: prepare variables - name: prepare variables
id: ev id: ev
run: | run: |
python ./scripts/gh_do_set_branch.py python ./scripts/gh_env.py
- name: checkout current code - name: checkout current code
run: | run: |
set -x set -x
@ -290,7 +290,7 @@ jobs:
env: env:
DOCKER_USERNAME: ${{ secrets.HARBOR_USERNAME }} DOCKER_USERNAME: ${{ secrets.HARBOR_USERNAME }}
run: | run: |
python ./scripts/gh_do_set_branch.py python ./scripts/gh_env.py
- name: Login to Container Registry - name: Login to Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
if: ${{ steps.ev.outputs.shouldBuild == 'true' }} if: ${{ steps.ev.outputs.shouldBuild == 'true' }}

View File

@ -48,7 +48,7 @@ jobs:
env: env:
DOCKER_USERNAME: ${{ secrets.HARBOR_USERNAME }} DOCKER_USERNAME: ${{ secrets.HARBOR_USERNAME }}
run: | run: |
python ./scripts/gh_do_set_branch.py python ./scripts/gh_env.py
- name: Login to Container Registry - name: Login to Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
if: ${{ steps.ev.outputs.shouldBuild == 'true' }} if: ${{ steps.ev.outputs.shouldBuild == 'true' }}

View File

@ -9,12 +9,11 @@ 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/", "")
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=branchNameContainer]%s" % branch_name.replace("refs/heads/", "").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)