Skip to content

Commit

Permalink
Adjust for new asset naming scheme (#234)
Browse files Browse the repository at this point in the history
Work around new naming scheme

Until version 0.15.1, the naming scheme of the release assets let them
start with `lychee-<version>-`. This is no longer the case as of
lycheeverse/lychee#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 lycheeverse/lychee#1464).
DRY up the lengthy `.tar` file name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho authored Aug 20, 2024
1 parent 25a2310 commit ff9963a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ff9963a

Please sign in to comment.