From ff9963a92315e746f8a355077d6c6d880f01ec9a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 20 Aug 2024 17:01:15 +0200 Subject: [PATCH] Adjust for new asset naming scheme (#234) Work around new naming scheme Until version 0.15.1, the naming scheme of the release assets let them start with `lychee--`. This is no longer the case as of https://github.com/lycheeverse/lychee/pull/1464, though, breaking the `lychee-action`. Since we need to allow using older versions, still, we are now stuck with a really ugly `case` construct, but this is still far better than having a broken GitHub Action. The name of the `.tar` file is repeated multiple times, verbatim. This not only violates the Don't Repeat Yourself (DRY) principle, it also makes it easier to miss an instance when the file name changes (as it did with https://github.com/lycheeverse/lychee/pull/1464). DRY up the lengthy `.tar` file name. Signed-off-by: Johannes Schindelin --- action.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 8cdcb75..dd2ba44 100644 --- a/action.yml +++ b/action.yml @@ -48,10 +48,14 @@ runs: run: | # Cleanup artifacts from previous run in case it crashed rm -rf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" lychee - curl -sLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" - tar -xvzf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" - rm "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" - install -t "$HOME/.local/bin" -D lychee + case '${{ inputs.LYCHEEVERSION }}' in + v0.0*|v0.1[0-5].*) filename='lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz';; + *) filename='lychee-x86_64-unknown-linux-gnu.tar.gz' + esac + curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/$filename" + tar -xvzf "$filename" + rm "$filename" + install -t "$HOME/.local/bin" -D lychee rm lychee echo "$HOME/.local/bin" >> "$GITHUB_PATH" shell: bash