mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-16 19:10:32 +02:00
Enhance onpush_builder.yaml with workflow_call support
Added support for workflow calls and updated environment variable handling in the onpush_builder workflow.
This commit is contained in:
16
.github/workflows/onpush_builder.yaml
vendored
16
.github/workflows/onpush_builder.yaml
vendored
@@ -3,6 +3,7 @@
|
||||
name: Builder
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -165,6 +166,7 @@ jobs:
|
||||
ADDON: ${{ matrix.addon }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_SHA_VALUE: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@@ -179,6 +181,7 @@ jobs:
|
||||
addon = os.environ["ADDON"]
|
||||
arch = os.environ["ARCH"]
|
||||
repository = os.environ["REPOSITORY"]
|
||||
github_sha = os.environ["GITHUB_SHA_VALUE"]
|
||||
addon_dir = Path(addon)
|
||||
output_path = Path(os.environ["GITHUB_OUTPUT"])
|
||||
|
||||
@@ -221,11 +224,11 @@ jobs:
|
||||
|
||||
dockerfile = addon_dir / f"Dockerfile.{arch}"
|
||||
if dockerfile.exists():
|
||||
dockerfile_name = dockerfile.name
|
||||
dockerfile_path = str(dockerfile)
|
||||
has_dockerfile = True
|
||||
else:
|
||||
dockerfile = addon_dir / "Dockerfile"
|
||||
dockerfile_name = dockerfile.name
|
||||
dockerfile_path = str(dockerfile)
|
||||
has_dockerfile = dockerfile.exists()
|
||||
|
||||
labels = [
|
||||
@@ -237,14 +240,16 @@ jobs:
|
||||
labels.append(f"io.hass.url={url}")
|
||||
|
||||
build_args = [
|
||||
f"BUILD_ARCH={arch}",
|
||||
f"BUILD_VERSION={version}",
|
||||
f"BUILD_DATE={build_date}",
|
||||
f"BUILD_DESCRIPTION={description}",
|
||||
f"BUILD_NAME={name}",
|
||||
f"BUILD_REF={os.environ.get('GITHUB_SHA', '')}",
|
||||
f"BUILD_REF={github_sha}",
|
||||
f"BUILD_REPOSITORY={repository}",
|
||||
]
|
||||
if build_from:
|
||||
build_args.insert(0, f"BUILD_FROM={build_from}")
|
||||
build_args.insert(2, f"BUILD_FROM={build_from}")
|
||||
|
||||
|
||||
def write_output(key: str, value: str):
|
||||
@@ -257,7 +262,7 @@ jobs:
|
||||
write_output("architectures", json.dumps(arch_list))
|
||||
write_output("build_arch", "true" if build_arch else "false")
|
||||
write_output("has_dockerfile", "true" if has_dockerfile else "false")
|
||||
write_output("dockerfile", dockerfile_name)
|
||||
write_output("dockerfile", dockerfile_path)
|
||||
write_output("image", image)
|
||||
write_output("version", version)
|
||||
write_output("name", name)
|
||||
@@ -412,3 +417,4 @@ jobs:
|
||||
done
|
||||
|
||||
git push origin HEAD:master
|
||||
|
||||
|
||||
Reference in New Issue
Block a user