diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index 95a0f2f03..8c8c9978a 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -35,8 +35,6 @@ on: env: DEFAULT_PYTHON: "3.14.3" COSIGN_VERSION: "v2.5.3" - CRANE_VERSION: "v0.20.7" - CRANE_SHA256: "8ef3564d264e6b5ca93f7b7f5652704c4dd29d33935aff6947dd5adefd05953e" BUILD_NAME: supervisor BUILD_TYPE: supervisor IMAGE_NAME: hassio-supervisor @@ -161,12 +159,6 @@ jobs: path: wheels retention-days: 1 - - name: Set version - if: needs.init.outputs.publish == 'true' - uses: home-assistant/actions/helpers/version@master - with: - type: ${{ env.BUILD_TYPE }} - - name: Set up Python ${{ env.DEFAULT_PYTHON }} if: needs.init.outputs.publish == 'true' uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 @@ -276,7 +268,7 @@ jobs: image: ghcr.io/home-assistant/amd64-hassio-supervisor image-tags: runner load: true - version: runner + version: ${{ needs.init.outputs.version }} # Pull the Supervisor for publish runs to test the published image - name: Pull Supervisor diff --git a/Dockerfile b/Dockerfile index 110239e29..b513206f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,9 +40,11 @@ RUN \ ${LOCAL_WHEELS:+--find-links $LOCAL_WHEELS} # Install Home Assistant Supervisor +ARG BUILD_VERSION="9999.09.9.dev9999" COPY . supervisor RUN \ - uv pip install --no-cache -e ./supervisor \ + sed -i "s/^SUPERVISOR_VERSION =.*/SUPERVISOR_VERSION = \"${BUILD_VERSION}\"/g" /usr/src/supervisor/supervisor/const.py \ + && uv pip install --no-cache -e ./supervisor \ && python3 -m compileall ./supervisor/supervisor diff --git a/setup.py b/setup.py index 8e09ae7a5..a1ceb2db3 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,9 @@ import re from setuptools import setup -RE_SUPERVISOR_VERSION = re.compile(r"^SUPERVISOR_VERSION =\s*(.+)$") +RE_SUPERVISOR_VERSION = re.compile( + r'^SUPERVISOR_VERSION =\s*"?((?P[0-9a-f]{40})|[^"]+)"?$' +) SUPERVISOR_DIR = Path(__file__).parent REQUIREMENTS_FILE = SUPERVISOR_DIR / "requirements.txt" @@ -16,13 +18,15 @@ CONSTANTS = CONST_FILE.read_text(encoding="utf-8") def _get_supervisor_version(): - for line in CONSTANTS.split("/n"): + for line in CONSTANTS.split("\n"): if match := RE_SUPERVISOR_VERSION.match(line): + if git_sha := match.group("git_sha"): + return f"9999.09.9.dev9999+{git_sha}" return match.group(1) return "9999.09.9.dev9999" setup( version=_get_supervisor_version(), - dependencies=REQUIREMENTS.split("/n"), + dependencies=REQUIREMENTS.split("\n"), )