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

Improve release asset download #298

Open
szepeviktor opened this issue Aug 14, 2023 · 0 comments
Open

Improve release asset download #298

szepeviktor opened this issue Aug 14, 2023 · 0 comments

Comments

@szepeviktor
Copy link
Contributor

szepeviktor commented Aug 14, 2023

Currently it goes like

wget --progress=dot:giga \
    https://github.com/spdx/tools-java/releases/download/v${{ inputs.spdx-tools-version }}/tools-java-${{ inputs.spdx-tools-version }}.zip

GHA images include GitHub CLI.
So we can improve the process.

mkdir -p "${{ runner.temp }}/spdx"
RELEASE_ASSET_URL="$(
    gh api /repos/spdx/tools-java/releases/${{ inputs.spdx-tools-release-id }} \
        --jq '."assets"[] | select(."name" | test("^tools-java-.+\\.zip$")) | ."browser_download_url"'
)"
wget --secure-protocol=TLSv1_3 --max-redirect=1 --retry-on-host-error --retry-connrefused --tries=3 \
    --no-verbose --output-document="${{ runner.temp }}/spdx/tools-java.zip" "${RELEASE_ASSET_URL}"

source

Here is how to list releases.

gh api /repos/spdx/tools-java/releases --jq '.[] | ."name" + ":" + (."id"|tostring)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant