Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to get development build #5

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions get/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.1.0

- Added option to get development builds
- Change base images to `*-base-python:3.12-alpine3.20`

ludeeus marked this conversation as resolved.
Show resolved Hide resolved
# 1.0.0

Initial release
9 changes: 5 additions & 4 deletions get/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ARG BUILD_FROM
FROM $BUILD_FROM

RUN \
wget -O /get-hacs https://raw.githubusercontent.com/hacs/get/main/get \
&& chmod +x /get-hacs
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

CMD ["bash", "/get-hacs"]
COPY rootfs /
RUN apk add --no-cache git

CMD [ "/etc/addon/run" ]
ludeeus marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions get/build.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
build_from:
aarch64: "ghcr.io/home-assistant/aarch64-base:3.15"
amd64: "ghcr.io/home-assistant/amd64-base:3.15"
armhf: "ghcr.io/home-assistant/armhf-base:3.15"
armv7: "ghcr.io/home-assistant/armv7-base:3.15"
i386: "ghcr.io/home-assistant/i386-base:3.15"
aarch64: "ghcr.io/home-assistant/aarch64-base-python:3.12-alpine3.20"
amd64: "ghcr.io/home-assistant/amd64-base-python:3.12-alpine3.20"
armhf: "ghcr.io/home-assistant/armhf-base-python:3.12-alpine3.20"
armv7: "ghcr.io/home-assistant/armv7-base-python:3.12-alpine3.20"
i386: "ghcr.io/home-assistant/i386-base-python:3.12-alpine3.20"
labels:
org.opencontainers.image.title: "HACS: get"
org.opencontainers.image.description: "Get HCS"
Expand Down
4 changes: 3 additions & 1 deletion get/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Get HACS
version: "1.0.0"
version: "1.1.0"
slug: get
image: "ghcr.io/hacs/{arch}-addon-get"
description: The easiest way to get HACS for Home Assistant
Expand All @@ -13,5 +13,7 @@ arch:
- amd64
- i386
init: false
schema:
channel: list(current|development)?
map:
- homeassistant_config:rw
49 changes: 49 additions & 0 deletions get/rootfs/etc/addon/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash

CHANNEL=$(bashio::config 'channel' 'current')

bashio::log.info "------------------------------------"
bashio::log.info "Starting HACS download..."
bashio::log.info "Channel: ${CHANNEL}"
bashio::log.info "------------------------------------"


if bashio::var.equals "${CHANNEL}" "current"; then
wget -O ./get-hacs https://raw.githubusercontent.com/hacs/get/main/get
chmod +x ./get-hacs
bash ./get-hacs

elif bashio::var.equals "${CHANNEL}" "development"; then
bashio::log.info "Downloading the integration source..."
if bashio::fs.directory_exists "/tmp/hacs"; then
bashio::log.info "Cleaning up the previous download..."
rm -rf /tmp/hacs
fi

git clone --depth 1 --branch main https://github.com/hacs/integration.git /tmp/hacs

cd /tmp/hacs || bashio::exit.nok "Could not find the integration source"

bashio::log.info "Installing the frontend..."
bash ./scripts/install/frontend

bashio::log.info "Injecting a version..."
current_version=$(curl -sSL https://data-v2.hacs.xyz/integration/data.json | jq -r '.["172733314"].last_version')
updated_version="$(echo "${current_version}" | awk -F. -v OFS=. '{$NF += 1 ; print}').dev$(git rev-parse --short HEAD)"
python3 ./scripts/update/manifest.py --version "${updated_version}"
bashio::log.info "Version set to: ${updated_version}"

bashio::log.info "Copying the integration source..."
cd /
rm -rf /homeassistant/custom_components/hacs
mv /tmp/hacs/custom_components/hacs /homeassistant/custom_components/hacs
rm -rf /tmp/hacs

bashio::log.info "Download complete..."
bashio::log.info "Remember to restart Home Assistant before you configure it..."

else
bashio::exit.nok "Invalid channel!"
ludeeus marked this conversation as resolved.
Show resolved Hide resolved

fi
4 changes: 4 additions & 0 deletions get/translations/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuration:
channel:
name: Channel
description: What channel should be used to download HACS.
Loading