Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version support to .sh script #157

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions helpers/installcredprovider.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
#!/usr/bin/env bash
# DESCRIPTION: A simple shell script designed to fetch the latest version
# DESCRIPTION: A simple shell script designed to fetch a version
# of the artifacts credential provider plugin for dotnet and
# install it into $HOME/.nuget/plugins.
# SEE: https://github.com/Microsoft/artifacts-credprovider/blob/master/README.md
# Default version to install is the latest version.
# To install a specific version, call the script with the TAG NAME of the version,
# e.g. "installcredprovider.sh v0.1.20". Find the tag name of the version from https://github.com/microsoft/artifacts-credprovider/releases
# More: https://github.com/Microsoft/artifacts-credprovider/blob/master/README.md

REPO="Microsoft/artifacts-credprovider"
FILE="Microsoft.NuGet.CredentialProvider.tar.gz"
VERSION="latest"
# URL pattern documented at https://help.github.com/en/articles/linking-to-releases as of 2019-03-29
URI="https://github.com/$REPO/releases/$VERSION/download/$FILE"
NUGET_PLUGIN_DIR="$HOME/.nuget/plugins"

# if no arguments, install latest version
if [ -z "$1" ]; then
# URL pattern to get latest documented at https://help.github.com/en/articles/linking-to-releases as of 2019-03-29
URI="https://github.com/$REPO/releases/latest/download/$FILE"
else
# browser_download_url from https://api.github.com/repos/Microsoft/artifacts-credprovider/releases/latest
VERSION=$1
URI="https://github.com/$REPO/releases/download/$1/$FILE"
fi

# Ensure plugin directory exists
if [ ! -d "${NUGET_PLUGIN_DIR}" ]; then
echo "INFO: Creating the nuget plugin directory (i.e. ${NUGET_PLUGIN_DIR}). "
Expand Down