From afcc1251fd3119e50cf63b3a1a61f8ee3ba9993e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20T=C3=B6lle?= <julian.toelle@hetzner-cloud.de>
Date: Tue, 14 Mar 2023 09:29:40 +0100
Subject: [PATCH] ci: fix goreleaser helm chart config (#390)

There were [two
issues](https://github.com/hetznercloud/hcloud-cloud-controller-manager/actions/runs/4407161651/jobs/7720443310#step:9:54)
with the goreleaser config:

- The publishing step is executed once per artifact by default, we have
two artifacts (`deployment-yamls`, `hcloud-cloud-controller-manager`).
By setting the id we make sure that its only executed once.
- The CHART_REPO_REMOTE variable was not available in the script.
Environment variables need to be explicitly passed to downstream
commands in goreleaser.
---
 .goreleaser.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.goreleaser.yml b/.goreleaser.yml
index 1f22162a..9fba6621 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -46,4 +46,8 @@ release:
 
 publishers:
   - name: helm-chart-repo
+    ids: # make sure that this is only executed once by filtering for *one arbitrary* artifact ID
+      - deployment-yamls
     cmd: ./scripts/publish-helm-chart.sh hcloud-cloud-controller-manager-{{ if not .IsSnapshot }}v{{ end }}{{ .Version }}.tgz
+    env:
+      - CHART_REPO_REMOTE={{ .Env.CHART_REPO_REMOTE }}
-- 
GitLab