From 11cb106a4e4a84d17bcd289474e6d3c223b3aa06 Mon Sep 17 00:00:00 2001
From: Andreas Sommer <andreas@giantswarm.io>
Date: Wed, 11 Sep 2024 10:53:15 +0100
Subject: [PATCH] Fix Giant Swarm fork release workflow (#608)

---
 .github/workflows/release.yaml | 36 ++++++++++------------------------
 1 file changed, 10 insertions(+), 26 deletions(-)

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 5034a43be2..ac541ad5cb 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -30,40 +30,24 @@ jobs:
 
           echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV # strip off `refs/tags/` prefix
 
-      - name: Check out code
-        uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag=v3.5.0
+      - name: checkout code
+        uses: actions/checkout@v4
         with:
           fetch-depth: 0
 
-      # - name: Calculate Go version
-      #   run: echo "go_version=$(make go-version)" >> $GITHUB_ENV
-
-      # - name: Set up Go
-      #   uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # tag=v3.5.0
-      #   with:
-      #     go-version: ${{ env.go_version }}
+      - name: Set up Go
+        uses: actions/setup-go@v5
+        with:
+          go-version: '1.22'
+          cache-dependency-path: |
+            ./go.sum
+            ./hack/tools/go.sum
 
       - name: Generate release artifacts
         env:
           GITHUB_TOKEN: "unused" # since we create the release without using CAPA's Makefile target
         run: |
-          # Dealing with changelogs isn't that easy since Giant Swarm releases can jump from `v2.2.0` to `v2.3.1`
-          # as we skip intermediate releases. Therefore, finding the required value for `PREVIOUS_VERSION` would be
-          # a manual task. Better not deal with the changelog right now since it's unlikely that someone will look
-          # at those in our fork (as compared to upstream's releases).
-          printf '#!/bin/sh\necho "Changelogs are not filled in this fork"\n' > hack/releasechangelog.sh # old path of this tool
-          mkdir -p hack/tools/bin
-          printf '#!/bin/sh\necho "Changelogs are not filled in this fork" > out/CHANGELOG.md\n' > hack/tools/bin/release-notes
-          chmod +x hack/tools/bin/release-notes
-
-          # We don't need the binaries and other stuff in the release, either. Really only the YAML manifests.
-          sed -i -E -e '/\$\(MAKE\) (release-binaries|release-templates|release-policies)/d' Makefile
-          sed -i -E -e '/cp metadata.yaml/d' Makefile
-
-          # To allow the above changes since normally the Makefile wouldn't allow a dirty Git repo
-          sed -i -e '/Your local git repository contains uncommitted changes/d' Makefile
-
-          (set -x; make PREVIOUS_VERSION="${RELEASE_TAG}" RELEASE_TAG="${RELEASE_TAG}" release)
+          make REGISTRY="registry.k8s.io/cluster-api-aws" RELEASE_TAG="${RELEASE_TAG}" release-manifests
 
       # Instead of `make VERSION="${RELEASE_TAG}" create-gh-release upload-gh-artifacts`, which requires GitHub CLI
       # authentication, use an action which does the same.