From a9db3c6d088ef7f33a212a7e43b50e623b8192d6 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Sat, 27 Jul 2024 23:58:56 -0500 Subject: [PATCH] chore(action): Download assets using `gh release download` --- action.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index 68e7bd9..798b4c8 100644 --- a/action.yml +++ b/action.yml @@ -67,21 +67,21 @@ runs: echo "Installing changelog generator $VERSION..." DEST="$RUNNER_TEMP/changelog-generator" - URL="$(jq -r --arg OS "$OS" \ - '.assets[] | select(.name | ascii_downcase | test($OS + "_(amd64|x86_64).(tar.gz|zip)$")) | .url' \ + ASSET="$(jq -r --arg OS "$OS" \ + '.assets[].name | select(ascii_downcase | test($OS + "_(amd64|x86_64).(tar.gz|zip)$"))' \ <<<"$RELEASE" \ )" - echo "Downloading $URL" + echo "Downloading $ASSET" mkdir -p "$DEST" cd "$DEST" - case "$URL" in + case "$ASSET" in *.tar.gz) - curl -sfL "$URL" | tar -xzf - "$FILENAME";; + gh release download "$VERSION" --pattern="$ASSET" --output=- | tar -xzf - "$FILENAME" ;; *.zip) - curl -sfL -o app.zip "$URL" - unzip app.zip "$FILENAME" - rm app.zip + gh release download "$VERSION" --pattern="$ASSET" + unzip "$ASSET" "$FILENAME" + rm "$ASSET" ;; *) echo Invalid file type; exit 1;;