ci: fix missing build args for dev and release (#12760) * ci: fix missing build args for dev and release * fix? --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens L. <jens@goauthentik.io>
This commit is contained in:
committed by
GitHub
parent
7d5cfb6356
commit
4b14eca2da
@ -9,6 +9,9 @@ inputs:
|
|||||||
image-arch:
|
image-arch:
|
||||||
required: false
|
required: false
|
||||||
description: "Docker image arch"
|
description: "Docker image arch"
|
||||||
|
release:
|
||||||
|
required: true
|
||||||
|
description: "True if this is a release build, false if this is a dev/PR build"
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
shouldPush:
|
shouldPush:
|
||||||
@ -44,6 +47,9 @@ outputs:
|
|||||||
imageMainName:
|
imageMainName:
|
||||||
description: "Docker image main name"
|
description: "Docker image main name"
|
||||||
value: ${{ steps.ev.outputs.imageMainName }}
|
value: ${{ steps.ev.outputs.imageMainName }}
|
||||||
|
imageBuildArgs:
|
||||||
|
description: "Docker image build args"
|
||||||
|
value: ${{ steps.ev.outputs.imageBuildArgs }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@ -54,6 +60,8 @@ runs:
|
|||||||
env:
|
env:
|
||||||
IMAGE_NAME: ${{ inputs.image-name }}
|
IMAGE_NAME: ${{ inputs.image-name }}
|
||||||
IMAGE_ARCH: ${{ inputs.image-arch }}
|
IMAGE_ARCH: ${{ inputs.image-arch }}
|
||||||
|
RELEASE: ${{ inputs.release }}
|
||||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||||
|
REF: ${{ github.ref }}
|
||||||
run: |
|
run: |
|
||||||
python3 ${{ github.action_path }}/push_vars.py
|
python3 ${{ github.action_path }}/push_vars.py
|
||||||
|
|||||||
@ -80,6 +80,13 @@ if should_push:
|
|||||||
cache_to = f"type=registry,ref={get_attest_image_names(image_tags)}:{_cache_tag},mode=max"
|
cache_to = f"type=registry,ref={get_attest_image_names(image_tags)}:{_cache_tag},mode=max"
|
||||||
|
|
||||||
|
|
||||||
|
image_build_args = []
|
||||||
|
if os.getenv("RELEASE", "false").lower() == "true":
|
||||||
|
image_build_args = [f"VERSION={os.getenv('REF')}"]
|
||||||
|
else:
|
||||||
|
image_build_args = [f"GIT_BUILD_HASH={sha}"]
|
||||||
|
image_build_args = "\n".join(image_build_args)
|
||||||
|
|
||||||
with open(os.environ["GITHUB_OUTPUT"], "a+", encoding="utf-8") as _output:
|
with open(os.environ["GITHUB_OUTPUT"], "a+", encoding="utf-8") as _output:
|
||||||
print(f"shouldPush={str(should_push).lower()}", file=_output)
|
print(f"shouldPush={str(should_push).lower()}", file=_output)
|
||||||
print(f"sha={sha}", file=_output)
|
print(f"sha={sha}", file=_output)
|
||||||
@ -91,3 +98,4 @@ with open(os.environ["GITHUB_OUTPUT"], "a+", encoding="utf-8") as _output:
|
|||||||
print(f"imageMainTag={image_main_tag}", file=_output)
|
print(f"imageMainTag={image_main_tag}", file=_output)
|
||||||
print(f"imageMainName={image_tags[0]}", file=_output)
|
print(f"imageMainName={image_tags[0]}", file=_output)
|
||||||
print(f"cacheTo={cache_to}", file=_output)
|
print(f"cacheTo={cache_to}", file=_output)
|
||||||
|
print(f"imageBuildArgs={image_build_args}", file=_output)
|
||||||
|
|||||||
@ -50,6 +50,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
image-name: ${{ inputs.image_name }}
|
image-name: ${{ inputs.image_name }}
|
||||||
image-arch: ${{ inputs.image_arch }}
|
image-arch: ${{ inputs.image_arch }}
|
||||||
|
release: ${{ inputs.release }}
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: ${{ inputs.registry_dockerhub }}
|
if: ${{ inputs.registry_dockerhub }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@ -81,7 +82,7 @@ jobs:
|
|||||||
GEOIPUPDATE_ACCOUNT_ID=${{ secrets.GEOIPUPDATE_ACCOUNT_ID }}
|
GEOIPUPDATE_ACCOUNT_ID=${{ secrets.GEOIPUPDATE_ACCOUNT_ID }}
|
||||||
GEOIPUPDATE_LICENSE_KEY=${{ secrets.GEOIPUPDATE_LICENSE_KEY }}
|
GEOIPUPDATE_LICENSE_KEY=${{ secrets.GEOIPUPDATE_LICENSE_KEY }}
|
||||||
build-args: |
|
build-args: |
|
||||||
VERSION=${{ github.ref }}
|
${{ steps.ev.outputs.imageBuildArgs }}
|
||||||
tags: ${{ steps.ev.outputs.imageTags }}
|
tags: ${{ steps.ev.outputs.imageTags }}
|
||||||
platforms: linux/${{ inputs.image_arch }}
|
platforms: linux/${{ inputs.image_arch }}
|
||||||
cache-from: type=registry,ref=${{ steps.ev.outputs.attestImageNames }}:buildcache-${{ inputs.image_arch }}
|
cache-from: type=registry,ref=${{ steps.ev.outputs.attestImageNames }}:buildcache-${{ inputs.image_arch }}
|
||||||
|
|||||||
Reference in New Issue
Block a user