Created
June 17, 2022 04:57
-
-
Save maestre3d/5e443474f8764734bce73dc3401e982f to your computer and use it in GitHub Desktop.
Force a Go package publishing using pure Curl and shell commands.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while getopts ":v:" opt; do | |
case $opt in | |
v) VERSION_TAG=$OPTARG;; | |
\?) | |
echo "Invalid option: -$OPTARG" >&2 | |
exit 1 | |
;; | |
:) | |
echo "Option -$OPTARG requires an argument." >&2 | |
exit 1 | |
;; | |
esac | |
done | |
MAJOR_VERSION="" | |
VERSION_PREFIX="" | |
if [ "${#VERSION_TAG}" -ge 2 ] | |
then | |
VERSION_PREFIX="${VERSION_TAG:0:2}" | |
fi | |
if [ "$VERSION_PREFIX" != "" ] && [ "$VERSION_PREFIX" != "v0" ] && [ "$VERSION_PREFIX" != "v1" ] | |
then | |
MAJOR_VERSION="/$VERSION_PREFIX" | |
fi | |
GO_PROXY_URL=https://proxy.golang.org/github.com/REPO_OWNER_USERNAME/REPO_NAME"$MAJOR_VERSION"/@v/"$VERSION_TAG".info | |
echo "forcing package publishing using URL: $GO_PROXY_URL" | |
curl "$GO_PROXY_URL" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment