Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tube0013 committed Jan 9, 2024
1 parent 2b0ddbf commit a81e00e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ jobs:
changed: ${{ steps.changed_addons.outputs.changed }}
steps:
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1

- name: Get changed files
id: changed_files
uses: jitterbit/get-changed-files@v1
continue-on-error: true

- name: Find add-on directories
id: addons
Expand All @@ -53,8 +52,8 @@ jobs:
if [[ -n ${changed} ]]; then
echo "Changed add-ons: $changed";
echo "::set-output name=changed::true";
echo "::set-output name=addons::[$changed]";
echo "changed=true" >> $GITHUB_OUTPUT;
echo "addons=[$changed]" >> $GITHUB_OUTPUT;
else
echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})";
fi
Expand All @@ -70,7 +69,7 @@ jobs:

steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1

- name: Get information
id: info
Expand All @@ -82,27 +81,27 @@ jobs:
id: check
run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "::set-output name=build_arch::true";
echo "::set-output name=image::$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)";
echo "build_arch=true" >> $GITHUB_OUTPUT;
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
echo "BUILD_ARGS=" >> $GITHUB_ENV;
fi
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "::set-output name=build_arch::false";
echo "build_arch=false" >> $GITHUB_OUTPUT;
fi
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2023.03.0
uses: home-assistant/builder@2023.12.0
with:
args: |
${{ env.BUILD_ARGS }} \
Expand Down

0 comments on commit a81e00e

Please sign in to comment.