From d952d5a1865da122577d008bd48e66f094d6bf86 Mon Sep 17 00:00:00 2001 From: Aleksander Aleksic Date: Wed, 17 Sep 2025 21:45:24 +0200 Subject: [PATCH 1/7] Support workflow dispatch --- .github/workflows/release.yaml | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 845489b..374e062 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,6 +1,11 @@ name: Release on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to release (e.g., v1.0.0)' + required: true push: tags: - 'v*' @@ -51,9 +56,16 @@ jobs: - name: Extract version from tag id: version run: | - VERSION=${GITHUB_REF#refs/tags/v} + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + # Use the manually provided tag input + TAG="${{ github.event.inputs.tag }}" + VERSION="${TAG#v}" + else + # Extract from GITHUB_REF for tag pushes + TAG="${GITHUB_REF#refs/tags/}" + VERSION="${TAG#v}" + fi echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - name: Update Chart.yaml with release version run: | @@ -116,7 +128,15 @@ jobs: - name: Extract version from tag id: version run: | - VERSION=${GITHUB_REF#refs/tags/v} + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + # Use the manually provided tag input + TAG="${{ github.event.inputs.tag }}" + VERSION="${TAG#v}" + else + # Extract from GITHUB_REF for tag pushes + TAG="${GITHUB_REF#refs/tags/}" + VERSION="${TAG#v}" + fi echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Update Chart.yaml with release version @@ -131,7 +151,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare Image Name + id: image_name + run: | + echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT + - name: Package and push Helm chart to OCI registry run: | helm package chart --version ${{ steps.version.outputs.version }} --app-version ${{ steps.version.outputs.version }} - helm push flux-extension-controller-${{ steps.version.outputs.version }}.tgz oci://${{ env.registry }}/${{ github.repository_owner }}/charts/flux-extension-controller + helm push flux-extension-controller-${{ steps.version.outputs.version }}.tgz oci://${{ env.registry }}/${{ steps.image_name.outputs.repo_owner }}/charts From e91623bc7954c06a45a70a237d7aeea281d36d18 Mon Sep 17 00:00:00 2001 From: Aleksander Aleksic Date: Wed, 17 Sep 2025 22:01:16 +0200 Subject: [PATCH 2/7] Suffix chart release with "charts" --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 374e062..1ce3240 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -159,4 +159,4 @@ jobs: - name: Package and push Helm chart to OCI registry run: | helm package chart --version ${{ steps.version.outputs.version }} --app-version ${{ steps.version.outputs.version }} - helm push flux-extension-controller-${{ steps.version.outputs.version }}.tgz oci://${{ env.registry }}/${{ steps.image_name.outputs.repo_owner }}/charts + helm push flux-extension-controller-${{ steps.version.outputs.version }}.tgz oci://${{ env.registry }}/${{ steps.image_name.outputs.name }}-chart From c135a86a0961c71382db9bbae8218e2a50157ea1 Mon Sep 17 00:00:00 2001 From: Aleksander Aleksic Date: Wed, 17 Sep 2025 22:07:06 +0200 Subject: [PATCH 3/7] Add dockerignore for faster docker builds --- .dockerignore | 6 ++++++ .gitignore | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..be78ebe --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.github +.gitignore +config.yaml.example +renovate.json +LICENSE +README.md \ No newline at end of file diff --git a/.gitignore b/.gitignore index fdbe97e..6a49923 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,3 @@ config.yaml # Coverage files cover.out coverage.txt - -# Docker build context -.dockerignore From f2e94995926f7014bad16cabd48c5a88461afe9f Mon Sep 17 00:00:00 2001 From: Aleksander Aleksic Date: Wed, 17 Sep 2025 22:10:25 +0200 Subject: [PATCH 4/7] Only create github release if its based on a tag --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1ce3240..6e665ef 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -100,11 +100,11 @@ jobs: - name: Create GitHub Release uses: softprops/action-gh-release@v1 + if: github.ref_type == 'tag' with: files: | flux-extension-controller-${{ steps.version.outputs.version }}.tgz generate_release_notes: true - make_latest: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d533e6cf80be931fb4a8d36bed3abaa88297f5e3 Mon Sep 17 00:00:00 2001 From: Aleksander Aleksic Date: Wed, 17 Sep 2025 22:15:01 +0200 Subject: [PATCH 5/7] Remove if for helmchart release job --- .github/workflows/release.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6e665ef..bb45b9c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -111,7 +111,6 @@ jobs: publish-helm-chart: runs-on: ubuntu-latest needs: release - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') permissions: contents: read packages: write From 1efcd6b983d3b4fb47728cbf01fec07229629fcb Mon Sep 17 00:00:00 2001 From: Aleksander Aleksic Date: Wed, 17 Sep 2025 22:31:55 +0200 Subject: [PATCH 6/7] Push helm charts as part of /charts prefix --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bb45b9c..4794f96 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -158,4 +158,4 @@ jobs: - name: Package and push Helm chart to OCI registry run: | helm package chart --version ${{ steps.version.outputs.version }} --app-version ${{ steps.version.outputs.version }} - helm push flux-extension-controller-${{ steps.version.outputs.version }}.tgz oci://${{ env.registry }}/${{ steps.image_name.outputs.name }}-chart + helm push flux-extension-controller-${{ steps.version.outputs.version }}.tgz oci://${{ env.registry }}/charts/ From 845908fd59e0f8ef64e54a0bdebbc012ced38ff4 Mon Sep 17 00:00:00 2001 From: Aleksander Aleksic Date: Wed, 17 Sep 2025 22:38:45 +0200 Subject: [PATCH 7/7] Remove workflow dispatch --- .github/workflows/release.yaml | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4794f96..d65396f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,11 +1,6 @@ name: Release on: - workflow_dispatch: - inputs: - tag: - description: 'Tag to release (e.g., v1.0.0)' - required: true push: tags: - 'v*' @@ -56,15 +51,9 @@ jobs: - name: Extract version from tag id: version run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - # Use the manually provided tag input - TAG="${{ github.event.inputs.tag }}" - VERSION="${TAG#v}" - else - # Extract from GITHUB_REF for tag pushes - TAG="${GITHUB_REF#refs/tags/}" - VERSION="${TAG#v}" - fi + # Extract from GITHUB_REF for tag pushes + TAG="${GITHUB_REF#refs/tags/}" + VERSION="${TAG#v}" echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Update Chart.yaml with release version @@ -127,15 +116,9 @@ jobs: - name: Extract version from tag id: version run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - # Use the manually provided tag input - TAG="${{ github.event.inputs.tag }}" - VERSION="${TAG#v}" - else - # Extract from GITHUB_REF for tag pushes - TAG="${GITHUB_REF#refs/tags/}" - VERSION="${TAG#v}" - fi + # Extract from GITHUB_REF for tag pushes + TAG="${GITHUB_REF#refs/tags/}" + VERSION="${TAG#v}" echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Update Chart.yaml with release version @@ -150,11 +133,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare Image Name - id: image_name - run: | - echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT - - name: Package and push Helm chart to OCI registry run: | helm package chart --version ${{ steps.version.outputs.version }} --app-version ${{ steps.version.outputs.version }}