diff --git a/.github/workflows/push-chart.yml b/.github/workflows/push-chart.yml index 5692661..bd6a024 100644 --- a/.github/workflows/push-chart.yml +++ b/.github/workflows/push-chart.yml @@ -2,6 +2,8 @@ name: push-chart on: push: + branches: + - '**' tags: - v* @@ -23,6 +25,7 @@ jobs: uses: azure/setup-helm@v4.3.1 - name: Log in to the Container registry + if: startsWith(github.ref, 'refs/tags/v') uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} @@ -32,17 +35,28 @@ jobs: - name: Extract version from tag id: get_version run: | - VERSION=${GITHUB_REF#refs/tags/v} - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Chart version: $VERSION" - - - name: Update Chart.yaml with version + if [[ "${{ github.ref }}" == refs/tags/v* ]]; then + VERSION=${GITHUB_REF#refs/tags/v} + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Chart version: $VERSION" + else + echo "Not a tag push, skipping version extraction" + echo "version=0.0.0-dev" >> $GITHUB_OUTPUT + fi + + - name: Set chart version run: | sed -i "s/^version:.*/version: ${{ steps.get_version.outputs.version }}/" ./chart/Chart.yaml sed -i "s/^appVersion:.*/appVersion: \"${{ steps.get_version.outputs.version }}\"/" ./chart/Chart.yaml cat ./chart/Chart.yaml + helm template --debug ./chart + + - name: Lint + run: | + helm lint chart - - name: Publish Helm chart to GHCR + - name: Publish chart to registry + if: startsWith(github.ref, 'refs/tags/v') run: | helm package chart helm push domaineer-${{ steps.get_version.outputs.version }}.tgz oci://${{ env.REGISTRY }}/gldraphael/charts diff --git a/.github/workflows/push-image.yml b/.github/workflows/push-image.yml index b8c074c..02bbdce 100644 --- a/.github/workflows/push-image.yml +++ b/.github/workflows/push-image.yml @@ -2,6 +2,8 @@ name: push-image on: push: + branches: + - '**' tags: - v* @@ -23,6 +25,7 @@ jobs: uses: actions/checkout@v5 - name: Log in to the Container registry + if: startsWith(github.ref, 'refs/tags/v') uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} @@ -40,6 +43,6 @@ jobs: with: context: ${{ env.CONTEXT }} file: ${{ env.DOCKERFILE }} - push: true + push: ${{ startsWith(github.ref, 'refs/tags/v') }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}