Skip to content

Commit

Permalink
Add option to get development build (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Jun 20, 2024
1 parent 47aa6de commit f33085f
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 10 deletions.
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`

# 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" ]
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!"

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.

0 comments on commit f33085f

Please sign in to comment.