-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup ecm-distro-tools GitHub Action (#267)
Signed-off-by: Brooks Newberry <[email protected]>
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 'Setup ecm-distro-tools' | ||
description: 'Installs ecm-distro-tools scripts to the PATH.' | ||
inputs: | ||
version: | ||
description: 'The tag of the ecm-distro-tools release to install.' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- shell: bash | ||
run: | | ||
TAG="${{ inputs.version }}" | ||
REPO="rancher/ecm-distro-tools" | ||
DOWNLOAD_DIR="$RUNNER_TEMP/ecm-distro-tools" | ||
mkdir -p "$DOWNLOAD_DIR" | ||
echo "$DOWNLOAD_DIR" >> "$GITHUB_PATH" | ||
GH_AUTHENTICATED=$(gh auth status >/dev/null 2>&1; echo $?) | ||
if [ "$GH_AUTHENTICATED" -eq 0 ]; then | ||
echo "is authenticated" | ||
gh release download "$TAG" --repo "$REPO" --dir "$DOWNLOAD_DIR" | ||
else | ||
echo "not authenticated" | ||
URLS=$(curl -s "https://api.github.com/repos/$REPO/releases/tags/$TAG" \ | ||
| jq -r '.assets[] | .browser_download_url') | ||
echo "$URLS" | while read -r url; do | ||
FILENAME=$(basename "$url") | ||
curl -sS -L "$url" -o "$DOWNLOAD_DIR/$FILENAME" | ||
done | ||
fi | ||
chmod +x "$DOWNLOAD_DIR/"* | ||
ls -al "$DOWNLOAD_DIR" |