Compare commits
2 commits
57028e3384
...
de734d2fc0
Author | SHA1 | Date | |
---|---|---|---|
de734d2fc0 | |||
cbd7b2dece |
2 changed files with 31 additions and 4 deletions
|
@ -7,6 +7,9 @@ on:
|
|||
type: string
|
||||
description: "App to build, e.g. 'home-assistant'"
|
||||
required: true
|
||||
push:
|
||||
paths:
|
||||
- "apps/**"
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
|
@ -15,12 +18,36 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- id: set-app-name
|
||||
name: Derive app name
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
changed_file=$(echo "${{ github.event.head_commit.modified[0] }}")
|
||||
app_name=$(echo "$changed_file" | awk -F'/' '{print $2}')
|
||||
echo "Derived app name: $app_name"
|
||||
echo "app=$app_name" >> $GITHUB_ENV
|
||||
else
|
||||
echo "app=${{ github.event.inputs.app }}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- id: set-context
|
||||
name: Determine build context
|
||||
run: |
|
||||
context_dir="/workspace/pub/containers/apps/${{ github.event.inputs.app }}"
|
||||
context_dir="/workspace/pub/containers/apps/${{ env.app }}"
|
||||
echo "context_dir=$context_dir" >> $GITHUB_OUTPUT
|
||||
|
||||
- id: check-dockerfile
|
||||
name: Ensure only one Dockerfile
|
||||
run: |
|
||||
dockerfile_count=$(find "${{ steps.set-context.outputs.context_dir }}" -type f -name "Dockerfile" | wc -l)
|
||||
|
||||
echo "Found $dockerfile_count Dockerfile(s)."
|
||||
|
||||
if [ "$dockerfile_count" -ne 1 ]; then
|
||||
echo "Error: Found $dockerfile_count Dockerfile(s). Only one Dockerfile is allowed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- id: parse-channel-platform
|
||||
name: Read channel + platform from metadata.yaml
|
||||
shell: bash
|
||||
|
@ -58,7 +85,7 @@ jobs:
|
|||
echo "Channel: ${{ steps.parse-channel-platform.outputs.channel }}"
|
||||
echo "Platform: ${{ steps.parse-channel-platform.outputs.platform }}"
|
||||
echo "Version: ${{ steps.read-version.outputs.version }}"
|
||||
echo "destinations: code.252.no/${{ github.repository }}/${{ github.event.inputs.app }}:${{ steps.read-version.outputs.version }}"
|
||||
echo "destinations: code.252.no/${{ github.repository }}/${{ env.app }}:${{ steps.read-version.outputs.version }}"
|
||||
echo "context: ${{ steps.set-context.outputs.context_dir }}"
|
||||
echo "TARGETPLATFORM=${{ steps.parse-channel-platform.outputs.platform }}"
|
||||
echo "VERSION=${{ steps.read-version.outputs.version }}"
|
||||
|
@ -70,7 +97,7 @@ jobs:
|
|||
context: ${{ steps.set-context.outputs.context_dir }}
|
||||
|
||||
# Build & push two tags: :<channel> and :<version>
|
||||
destinations: code.252.no/${{ github.repository }}/${{ github.event.inputs.app }}:${{ steps.read-version.outputs.version }}
|
||||
destinations: code.252.no/${{ github.repository }}/${{ env.app }}:${{ steps.read-version.outputs.version }}
|
||||
|
||||
# Pass any build arguments the Dockerfile expects
|
||||
build_args: |
|
||||
|
|
|
@ -74,7 +74,7 @@ RUN \
|
|||
postgresql-dev \
|
||||
unixodbc-dev \
|
||||
&& pip install uv \
|
||||
&& uv pip install pymiele==0.2.0 flatdict==4.0.1 \
|
||||
&& uv pip install pymiele==0.2.0 flatdict==4.0.1 pyeasee==0.8.11 pyelectroluxgroup==0.2.1 \
|
||||
&& curl -fsSL "https://github.com/home-assistant/core/archive/${VERSION}.tar.gz" | tar xzf - -C /tmp --strip-components=1 \
|
||||
&& HOME_ASSISTANT_BASE=$(curl -fsSL "https://raw.githubusercontent.com/home-assistant/core/${VERSION}/build.yaml" | grep "amd64: " | cut -d ":" -f3) \
|
||||
&& uv pip install --system --only-binary=:all: --find-links "${HOMEASSISTANT_WHEELS}" \
|
||||
|
|
Loading…
Add table
Reference in a new issue