Skip to content

Commit

Permalink
update action to use install script (#307)
Browse files Browse the repository at this point in the history
Co-authored-by: Pedro Tashima <[email protected]>
  • Loading branch information
tashima42 and tashima42 authored Nov 17, 2023
1 parent 437eef9 commit 4a42e6d
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,15 @@ inputs:
runs:
using: 'composite'
steps:
- shell: bash
- env:
INSTALL_SCRIPT_TAG: ${{ github.action_ref }}
shell: bash
run: |
INSTALL_SCRIPT_PATH="${RUNNER_TEMP}/install.sh"
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"
INSTALL_DIR=$HOME/.local/bin/ecm-distro-tools
wget -O "${INSTALL_SCRIPT_PATH}" "https://raw.githubusercontent.com/rancher/ecm-distro-tools/${INSTALL_SCRIPT_TAG}/install.sh"
chmod +x "${INSTALL_SCRIPT_PATH}"
${INSTALL_SCRIPT_PATH} ${TAG}
echo "${INSTALL_DIR}" >> "${GITHUB_PATH}"
ls -al "${INSTALL_DIR}"

0 comments on commit 4a42e6d

Please sign in to comment.