From 416d9f50b016979e245385120709429916f69046 Mon Sep 17 00:00:00 2001
From: Brad Davidson <brad.davidson@rancher.com>
Date: Wed, 25 Sep 2024 20:43:00 +0000
Subject: [PATCH] Fix uploading artifacts to existing release

Fixes issue where releases would be left without assets if the tag was created by the GH release UI, as the release would already exist.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
---
 .github/workflows/release.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index ced4d992..74d483e8 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -85,7 +85,8 @@ jobs:
           merge-multiple: true
 
       - name: Create GitHub release
-        run: gh release create "${{ env.TAG }}" --prerelease --title "${{ env.TAG }}" dist/artifacts/*
+        run: gh release create "${{ env.TAG }}" --prerelease --title "${{ env.TAG }}" dist/artifacts/* ||
+             gh release upload "${{ env.TAG }}" --clobber dist/artifacts/*
 
   # Builds Docker images using artifacts from the `build-test` job and pushes 
   # them to DockerHub.
@@ -221,4 +222,4 @@ jobs:
       
       - name: Inspect image
         run: |
-          docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }}          
\ No newline at end of file
+          docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }}
-- 
GitLab