Revert "feat: 改成 docker action"

This reverts commit 049673f182.
This commit is contained in:
Jeffery
2026-03-20 14:43:48 +08:00
parent ced4e93714
commit 7405c7ea2d
3 changed files with 23 additions and 91 deletions

View File

@@ -1,78 +0,0 @@
#!/bin/sh
set -eu
token="${INPUT_TOKEN:-}"
version="${INPUT_VERSION:?INPUT_VERSION is required}"
nuget_source="${INPUT_SOURCE:?INPUT_SOURCE is required}"
api_key="${INPUT_API_KEY:?INPUT_API_KEY is required}"
asset_index="${INPUT_INDEX:-0}"
server_url="${GITEA_SERVER_URL:-${GITHUB_SERVER_URL:-}}"
repository="${GITEA_REPOSITORY:-${GITHUB_REPOSITORY:-}}"
if [ -z "${server_url}" ]; then
echo "GITEA_SERVER_URL or GITHUB_SERVER_URL is required" >&2
exit 1
fi
if [ -z "${repository}" ]; then
echo "GITEA_REPOSITORY or GITHUB_REPOSITORY is required" >&2
exit 1
fi
release_url="${server_url}/api/v1/repos/${repository}/releases/tags/v${version}"
work_dir="/tmp/nuget-push"
archive_dir="${work_dir}/archive"
output_dir="${work_dir}/output"
mkdir -p "${archive_dir}" "${output_dir}"
fetch_json() {
if [ -n "${token}" ]; then
curl -fsSL -H "Authorization: token ${token}" "$1"
return
fi
curl -fsSL "$1"
}
download_file() {
if [ -n "${token}" ]; then
curl -fsSL -H "Authorization: token ${token}" "$1" -o "$2"
return
fi
curl -fsSL "$1" -o "$2"
}
echo "RELEASE_URL: ${release_url}"
release_json="$(fetch_json "${release_url}")"
download_name="$(printf '%s' "${release_json}" | jq -er ".assets[${asset_index}].name")"
download_url="$(printf '%s' "${release_json}" | jq -er ".assets[${asset_index}].browser_download_url")"
archive_path="${archive_dir}/${download_name}"
echo "DOWNLOAD_NAME: ${download_name}"
echo "DOWNLOAD_URL: ${download_url}"
echo "ARTIFACT DOWNLOADING..."
download_file "${download_url}" "${archive_path}"
echo "ARTIFACT UNZIPPING..."
unzip -o "${archive_path}" -d "${output_dir}" >/dev/null
packages_found=0
echo "ARTIFACT PUSHING..."
for package in "${output_dir}"/*.nupkg; do
if [ ! -f "${package}" ]; then
continue
fi
packages_found=1
dotnet nuget push "${package}" --source "${nuget_source}" --api-key "${api_key}" --skip-duplicate --allow-insecure-connections
done
if [ "${packages_found}" -eq 0 ]; then
echo "No .nupkg files found after extracting ${download_name}" >&2
exit 1
fi