diff --git a/action.yml b/action.yml index 2310ce9..d313992 100644 --- a/action.yml +++ b/action.yml @@ -53,42 +53,41 @@ runs: mkdir -p "$HOME/.local/bin" shell: bash - - name: Determine lychee filename - id: lychee-filename + - name: Clean up existing lychee files run: | - # Older releases (prior to 0.16.x) had the version number in the archive name. - # This determines the correct filename based on the version string. + # Remove any existing lychee binaries or archives to prevent conflicts + rm -f "$HOME/.local/bin/lychee" + rm -rf lychee + rm -f "${{ steps.lychee-filename.outputs.filename }}" + shell: bash + + - name: Determine lychee filename and download + id: lychee-download + run: | + # Determine filename and download URL based on version if [[ '${{ inputs.lycheeVersion }}' =~ ^v0\.0|^v0\.1[0-5]\. ]]; then - echo "filename=lychee-${{ inputs.lycheeVersion }}-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT - echo "tag=${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT + FILENAME="lychee-${{ inputs.lycheeVersion }}-x86_64-unknown-linux-gnu.tar.gz" + DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/${{ inputs.lycheeVersion }}/${FILENAME}" else - echo "filename=lychee-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT - # Each crate in the workspace has its own tag, so we need to specify the tag for the binary. - # The binary is released under the 'lychee' tag, the library under 'lychee-lib'. - # For nightly builds, we use the 'nightly' tag. + FILENAME="lychee-x86_64-unknown-linux-gnu.tar.gz" if [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then - echo "tag=${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT + DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/nightly/${FILENAME}" elif [[ '${{ inputs.lycheeVersion }}' == 'latest' ]]; then - echo "tag=latest" >> $GITHUB_OUTPUT + DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/latest/download/${FILENAME}" else - echo "tag=lychee-${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT + # 0.16.x and onwards + DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/lychee-${{ inputs.lycheeVersion }}/${FILENAME}" fi fi - shell: bash - - name: Clean up existing lychee files - run: | - # Remove any existing lychee binaries or archives to prevent conflicts - rm -f "$HOME/.local/bin/lychee" - rm -rf lychee - rm -f "${{ steps.lychee-filename.outputs.filename }}" - shell: bash + # Download lychee + curl -sfLO "${DOWNLOAD_URL}" - - name: Download lychee - run: | - curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ steps.lychee-filename.outputs.tag }}/${{ steps.lychee-filename.outputs.filename }}" + # Output filename for use in later steps + echo "filename=${FILENAME}" >> $GITHUB_OUTPUT shell: bash + - name: Extract lychee run: | tar -xvzf "${{ steps.lychee-filename.outputs.filename }}"