From 6f17f1f15da14ebe2438f8068ffa428801da87af Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:01:44 +0000 Subject: [PATCH 01/12] Update builder --- .github/workflows/builder.yaml | 42 ++++++++++++---------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index 819481c..a56cf4c 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -27,43 +27,31 @@ jobs: id: changed_files uses: jitterbit/get-changed-files@v1 - - name: Find add-on directories - id: addons - uses: home-assistant/actions/helpers/find-addons@master + - run: | + declare -a changed + for file in ${{ env.MONITORED_FILES }}; do + if [[ -n ${changed} ]]; then + break + fi - - name: Get changed add-ons - id: changed_addons - run: | - declare -a changed_addons - for addon in ${{ steps.addons.outputs.addons }}; do - if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon ]]; then - for file in ${{ env.MONITORED_FILES }}; do - if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon/$file ]]; then - if [[ ! "${changed_addons[@]}" =~ $addon ]]; then - changed_addons+=("\"${addon}\","); - fi - fi - done + if [[ "${{ steps.changed_files.outputs.all }}" =~ $file ]]; then + changed=true fi done - changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev) - if [[ -n ${changed} ]]; then - echo "Changed add-ons: $changed"; + echo "A monitored file changed."; echo "::set-output name=changed::true"; - echo "::set-output name=addons::[$changed]"; else - echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})"; + echo "No monitored files changed."; fi build: needs: init runs-on: ubuntu-latest if: needs.init.outputs.changed == 'true' - name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on + name: Build add-on strategy: matrix: - addon: ${{ fromJson(needs.init.outputs.changed_addons) }} arch: ["amd64", "armv7", "aarch64"] steps: @@ -74,7 +62,7 @@ jobs: id: info uses: home-assistant/actions/helpers/info@master with: - path: "./${{ matrix.addon }}" + path: "./" - name: Check if add-on should be built id: check @@ -86,7 +74,7 @@ jobs: echo "BUILD_ARGS=" >> $GITHUB_ENV; fi else - echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build"; + echo "${{ matrix.arch }} is not a valid arch for this add-on, skipping build"; echo "::set-output name=build_arch::false"; fi @@ -98,13 +86,13 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build ${{ matrix.addon }} add-on + - name: Build add-on if: steps.check.outputs.build_arch == 'true' uses: home-assistant/builder@master with: args: | ${{ env.BUILD_ARGS }} \ --${{ matrix.arch }} \ - --target /data/${{ matrix.addon }} \ + --target /data/${GITHUB_REPOSITORY##*/} \ --image "${{ steps.check.outputs.image }}" \ --addon From 58eab227fab00945cf0777ed24a7c47c5f2af7c7 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:06:13 +0000 Subject: [PATCH 02/12] Use updated method of setting output --- .github/workflows/builder.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index a56cf4c..a4fce9a 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -41,7 +41,7 @@ jobs: if [[ -n ${changed} ]]; then echo "A monitored file changed."; - echo "::set-output name=changed::true"; + echo "changed=true" >> $GITHUB_OUTPUT else echo "No monitored files changed."; fi @@ -68,14 +68,14 @@ 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 this add-on, skipping build"; - echo "::set-output name=build_arch::false"; + echo "build_arch=false" >> $GITHUB_OUTPUT fi - name: Login to GitHub Container Registry From 7da72f4670e42dd04d1c948ea7bb1d49b7c4ba44 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:07:33 +0000 Subject: [PATCH 03/12] Add name to build step --- .github/workflows/builder.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index a4fce9a..4fe549e 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -27,7 +27,8 @@ jobs: id: changed_files uses: jitterbit/get-changed-files@v1 - - run: | + - name: Check if monitored files changed + run: | declare -a changed for file in ${{ env.MONITORED_FILES }}; do if [[ -n ${changed} ]]; then From 9d3b18c02d4cc88281af2f761fd342d0089d8094 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:08:43 +0000 Subject: [PATCH 04/12] Fix linter --- .github/workflows/lint.yaml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 4d21274..9df12ee 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -9,26 +9,9 @@ on: - main jobs: - find: - name: Find add-ons - runs-on: ubuntu-latest - outputs: - addons: ${{ steps.addons.outputs.addons_list }} - steps: - - name: ⤵️ Check out code from GitHub - uses: actions/checkout@v4.1.2 - - - name: 🔍 Find add-on directories - id: addons - uses: home-assistant/actions/helpers/find-addons@master - lint: - name: Lint add-on ${{ matrix.path }} + name: Lint add-on runs-on: ubuntu-latest - needs: find - strategy: - matrix: - path: ${{ fromJson(needs.find.outputs.addons) }} steps: - name: ⤵️ Check out code from GitHub uses: actions/checkout@v4.1.2 @@ -36,4 +19,4 @@ jobs: - name: 🚀 Run Home Assistant Add-on Lint uses: frenck/action-addon-linter@v2 with: - path: "./${{ matrix.path }}" + path: "./" From bb852daaae95722ba11130cdea5a35c3799c2cb9 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:11:55 +0000 Subject: [PATCH 05/12] Remove unused var --- .github/workflows/builder.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index 4fe549e..b16d95c 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -17,7 +17,6 @@ jobs: runs-on: ubuntu-latest name: Initialize builds outputs: - changed_addons: ${{ steps.changed_addons.outputs.addons }} changed: ${{ steps.changed_addons.outputs.changed }} steps: - name: Check out the repository From 0796edd248b924c6302b899471adac1085bbdf0e Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:12:11 +0000 Subject: [PATCH 06/12] Test --- build.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.json b/build.json index 86f47db..e4cd60b 100644 --- a/build.json +++ b/build.json @@ -8,7 +8,7 @@ "ghostfolio_version": "2.65.0" }, "labels": { - "org.opencontainers.image.title": "Home Assistant Add-on: Ghostfolio", + "org.opencontainers.image.title": "Home Assistant Add-on: Ghostfolio TESTME", "org.opencontainers.image.description": "Privacy-first, open source dashboard for your personal finances.", "org.opencontainers.image.source": "https://github.com/lildude/ha-addon-ghostfolio/", "org.opencontainers.image.licenses": "MIT" From f13566c8bfaeec5799844b79f998bd0e7fbd7771 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:14:10 +0000 Subject: [PATCH 07/12] Fix context --- .github/workflows/builder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index b16d95c..35698f7 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest name: Initialize builds outputs: - changed: ${{ steps.changed_addons.outputs.changed }} + changed: ${{ steps.changed_files.outputs.changed }} steps: - name: Check out the repository uses: actions/checkout@v4.1.2 From 0f961c7e6f88206f4ebd11acc1032cc2aff39749 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:16:11 +0000 Subject: [PATCH 08/12] Whoops --- .github/workflows/builder.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index 35698f7..9de447f 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest name: Initialize builds outputs: - changed: ${{ steps.changed_files.outputs.changed }} + changed: ${{ steps.check.outputs.changed }} steps: - name: Check out the repository uses: actions/checkout@v4.1.2 @@ -27,6 +27,7 @@ jobs: uses: jitterbit/get-changed-files@v1 - name: Check if monitored files changed + id: check run: | declare -a changed for file in ${{ env.MONITORED_FILES }}; do From f1cbea2588c63a4aae3ef9dd78a0eb1e004b48c7 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:19:10 +0000 Subject: [PATCH 09/12] Adjust path --- .github/workflows/builder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index 9de447f..eb9ce18 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -94,6 +94,6 @@ jobs: args: | ${{ env.BUILD_ARGS }} \ --${{ matrix.arch }} \ - --target /data/${GITHUB_REPOSITORY##*/} \ + --target /data/ \ --image "${{ steps.check.outputs.image }}" \ --addon From 513b0140d9c4521a37154c9f2e8b8c141726d422 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:22:54 +0000 Subject: [PATCH 10/12] Correct namespace --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index c71b236..b532230 100644 --- a/config.json +++ b/config.json @@ -37,5 +37,5 @@ "jwt_secret_key": "str?" }, "codenotary": "colin@symr.io", - "image": "ghcr.io/lildude/ha-addon-ghostfolio/ghostfolio-{arch}" + "image": "ghcr.io/lildude/ghostfolio-{arch}" } \ No newline at end of file From 0e635c0ea4eadd68a8b5c7cf9d47cb9038b34b57 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:32:57 +0000 Subject: [PATCH 11/12] Rename image --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index b532230..cdf0821 100644 --- a/config.json +++ b/config.json @@ -37,5 +37,5 @@ "jwt_secret_key": "str?" }, "codenotary": "colin@symr.io", - "image": "ghcr.io/lildude/ghostfolio-{arch}" + "image": "ghcr.io/lildude/ha-addon-ghostfolio-{arch}" } \ No newline at end of file From bc216eb88d9c6819409525c4333806f95ed1b8d6 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 30 Mar 2024 11:37:48 +0000 Subject: [PATCH 12/12] Pluralise --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4dd594f..0b4cd01 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This addon allows you to run [Ghostfolio][] on your Home Assistant server based ![Ghostfolio Version](https://img.shields.io/badge/dynamic/json?label=Ghostfolio%20Version&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-ghostfolio%2Fmain%2Fbuild.json&query=%24.args.ghostfolio_version) ![Ingress](https://img.shields.io/badge/dynamic/json?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-ghostfolio%2Fmain%2Fconfig.json) -![Supported Architecture](https://img.shields.io/badge/dynamic/json?color=green&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-ghostfolio%2Fmain%2Fconfig.json) +![Supported Architectures](https://img.shields.io/badge/dynamic/json?color=green&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-ghostfolio%2Fmain%2Fconfig.json) | Light Mode | Dark Mode | | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |