-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,71 @@ | ||
name: Build | ||
|
||
on: | ||
schedule: | ||
- cron: '45 9 * * 1-4' | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- Dockerfile | ||
- rootfs/** | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
init: | ||
name: Init image build | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository_owner == 'home-assistant' }} | ||
outputs: | ||
target: ${{ steps.target.outputs.version }} | ||
tag: ${{ steps.version.outputs.string }} | ||
new_image: ${{ github.event_name == 'pull_request' || steps.existing_image.outcome == 'failure' }} | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Target version | ||
id: target | ||
run: | | ||
echo "version=$(curl -sSL https://version.home-assistant.io/beta.json | jq -r '.homeassistant.default')" >> $GITHUB_OUTPUT | ||
- name: Set version string | ||
id: version | ||
run: | | ||
echo "string=${{ steps.target.outputs.version }}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
- name: Check if image exist | ||
id: existing_image | ||
if: ${{ github.event_name != 'pull_request' }} | ||
continue-on-error: true | ||
run: | | ||
docker pull ghcr.io/${{ github.repository_owner }}/private-demo:${{ steps.version.outputs.string }} | ||
build: | ||
name: Build image | ||
runs-on: ubuntu-latest | ||
needs: | ||
- "init" | ||
if: ${{ needs.init.outputs.new_image }} | ||
environment: ${{ github.event_name != 'pull_request' && 'build' || '' }} | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/[email protected] | ||
if: ${{ github.event_name != 'pull_request' }} | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: false | ||
tags: "ghcr.io/${{ github.repository_owner }}/private-demo:pr-${{ github.event.number }}" | ||
push: ${{ github.event_name != 'pull_request' }} | ||
build-args: | | ||
TARGET_VERSION=${{ needs.init.outputs.target }} | ||
tags: "ghcr.io/${{ github.repository_owner }}/private-demo:${{ needs.init.outputs.tag }}" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
FROM ghcr.io/home-assistant/home-assistant:2024.8.0b7 | ||
ARG TARGET_VERSION=stable | ||
FROM ghcr.io/home-assistant/home-assistant:$TARGET_VERSION | ||
COPY rootfs / |