From b307a7f13695d40ea283d293616ebd8980893405 Mon Sep 17 00:00:00 2001 From: Wizkiller96 Date: Wed, 30 Oct 2024 15:54:14 -0400 Subject: [PATCH] fix: Should fix asset upload now? --- .gitlab-ci.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee8fa9a37..ba7d38358 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -128,25 +128,30 @@ release-github: echo "Failed to create a release" exit 1 fi - # Upload each asset + # Function to download and upload asset upload_asset() { local asset_name=$1 - local asset_file=$2 - local url=$3 + local asset_url=$2 + local asset_file=$(basename "$asset_url") + echo "Downloading asset: $asset_name from $asset_url" + curl -L -o "$asset_file" "$asset_url" if [ -f "$asset_file" ]; then echo "Uploading asset: $asset_name" - curl -X POST -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $(file -b --mime-type "$asset_file")" --data-binary @"$asset_file" "https://uploads.github.com/repos/wizkiller96/wizbot/releases/$RELEASE_ID/assets?name=$(basename $asset_name)" + curl -X POST -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $(file -b --mime-type "$asset_file")" --data-binary @"$asset_file" "https://uploads.github.com/repos/wizkiller96/wizbot/releases/$RELEASE_ID/assets?name=$(basename $asset_file)" else echo "Asset not found: $asset_file" fi } - upload_asset "${LINUX_X64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${LINUX_X64_RELEASE}" - upload_asset "${LINUX_ARM64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${LINUX_ARM64_RELEASE}" - upload_asset "${WIN_X64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${WIN_X64_RELEASE}" - upload_asset "${WIN_ARM64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${WIN_ARM64_RELEASE}" - upload_asset "${MACOS_X64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${MACOS_X64_RELEASE}" - upload_asset "${MACOS_ARM64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${MACOS_ARM64_RELEASE}" - upload_asset "${INSTALLER_FILE_NAME}" "${PACKAGE_REGISTRY_URL}/${INSTALLER_FILE_NAME}" + download_and_upload_assets() { + upload_asset "${LINUX_X64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${LINUX_X64_RELEASE}" + upload_asset "${LINUX_ARM64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${LINUX_ARM64_RELEASE}" + upload_asset "${WIN_X64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${WIN_X64_RELEASE}" + upload_asset "${WIN_ARM64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${WIN_ARM64_RELEASE}" + upload_asset "${MACOS_X64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${MACOS_X64_RELEASE}" + upload_asset "${MACOS_ARM64_RELEASE}" "${PACKAGE_REGISTRY_URL}/${MACOS_ARM64_RELEASE}" + upload_asset "${INSTALLER_FILE_NAME}" "${PACKAGE_REGISTRY_URL}/${INSTALLER_FILE_NAME}" + } + download_and_upload_assets test: stage: test