mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-06 07:35:56 +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
|
name: Builder
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_call:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
@@ -165,6 +166,7 @@ jobs:
|
|||||||
ADDON: ${{ matrix.addon }}
|
ADDON: ${{ matrix.addon }}
|
||||||
ARCH: ${{ matrix.arch }}
|
ARCH: ${{ matrix.arch }}
|
||||||
REPOSITORY: ${{ github.repository }}
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
GITHUB_SHA_VALUE: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -179,6 +181,7 @@ jobs:
|
|||||||
addon = os.environ["ADDON"]
|
addon = os.environ["ADDON"]
|
||||||
arch = os.environ["ARCH"]
|
arch = os.environ["ARCH"]
|
||||||
repository = os.environ["REPOSITORY"]
|
repository = os.environ["REPOSITORY"]
|
||||||
|
github_sha = os.environ["GITHUB_SHA_VALUE"]
|
||||||
addon_dir = Path(addon)
|
addon_dir = Path(addon)
|
||||||
output_path = Path(os.environ["GITHUB_OUTPUT"])
|
output_path = Path(os.environ["GITHUB_OUTPUT"])
|
||||||
|
|
||||||
@@ -221,11 +224,11 @@ jobs:
|
|||||||
|
|
||||||
dockerfile = addon_dir / f"Dockerfile.{arch}"
|
dockerfile = addon_dir / f"Dockerfile.{arch}"
|
||||||
if dockerfile.exists():
|
if dockerfile.exists():
|
||||||
dockerfile_name = dockerfile.name
|
dockerfile_path = str(dockerfile)
|
||||||
has_dockerfile = True
|
has_dockerfile = True
|
||||||
else:
|
else:
|
||||||
dockerfile = addon_dir / "Dockerfile"
|
dockerfile = addon_dir / "Dockerfile"
|
||||||
dockerfile_name = dockerfile.name
|
dockerfile_path = str(dockerfile)
|
||||||
has_dockerfile = dockerfile.exists()
|
has_dockerfile = dockerfile.exists()
|
||||||
|
|
||||||
labels = [
|
labels = [
|
||||||
@@ -237,14 +240,16 @@ jobs:
|
|||||||
labels.append(f"io.hass.url={url}")
|
labels.append(f"io.hass.url={url}")
|
||||||
|
|
||||||
build_args = [
|
build_args = [
|
||||||
|
f"BUILD_ARCH={arch}",
|
||||||
|
f"BUILD_VERSION={version}",
|
||||||
f"BUILD_DATE={build_date}",
|
f"BUILD_DATE={build_date}",
|
||||||
f"BUILD_DESCRIPTION={description}",
|
f"BUILD_DESCRIPTION={description}",
|
||||||
f"BUILD_NAME={name}",
|
f"BUILD_NAME={name}",
|
||||||
f"BUILD_REF={os.environ.get('GITHUB_SHA', '')}",
|
f"BUILD_REF={github_sha}",
|
||||||
f"BUILD_REPOSITORY={repository}",
|
f"BUILD_REPOSITORY={repository}",
|
||||||
]
|
]
|
||||||
if build_from:
|
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):
|
def write_output(key: str, value: str):
|
||||||
@@ -257,7 +262,7 @@ jobs:
|
|||||||
write_output("architectures", json.dumps(arch_list))
|
write_output("architectures", json.dumps(arch_list))
|
||||||
write_output("build_arch", "true" if build_arch else "false")
|
write_output("build_arch", "true" if build_arch else "false")
|
||||||
write_output("has_dockerfile", "true" if has_dockerfile 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("image", image)
|
||||||
write_output("version", version)
|
write_output("version", version)
|
||||||
write_output("name", name)
|
write_output("name", name)
|
||||||
@@ -412,3 +417,4 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
git push origin HEAD:master
|
git push origin HEAD:master
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user