Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
mre authored Oct 7, 2024
1 parent 9501e47 commit 0eca6a3
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,46 +53,58 @@ runs:
mkdir -p "$HOME/.local/bin"
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

- name: Determine lychee download URL
id: get-url
- name: Determine lychee filename
id: lychee-filename
run: |
# Older releases (prior to 0.16.x) had the version number in the archive name.
# This determines the correct filename and download URL based on the version string.
# This determines the correct filename based on the version string.
if [[ '${{ inputs.lycheeVersion }}' =~ ^v0\.0|^v0\.1[0-5]\. ]]; then
FILENAME="lychee-${{ inputs.lycheeVersion }}-x86_64-unknown-linux-gnu.tar.gz"
DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/${{ inputs.lycheeVersion }}/${FILENAME}"
echo "filename=lychee-${{ inputs.lycheeVersion }}-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT
echo "tag=${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT
else
FILENAME="lychee-x86_64-unknown-linux-gnu.tar.gz"
if [[ '${{ inputs.lycheeVersion }}' == 'latest' ]]; then
DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/latest/download/${FILENAME}"
elif [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then
DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/nightly/${FILENAME}"
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.
if [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then
echo "tag=${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT
elif [[ '${{ inputs.lycheeVersion }}' == 'latest' ]]; then
echo "tag=latest" >> $GITHUB_OUTPUT
else
DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/${{ inputs.lycheeVersion }}/${FILENAME}"
echo "tag=lychee-${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT
fi
fi
echo "filename=${FILENAME}" >> $GITHUB_OUTPUT
echo "download_url=${DOWNLOAD_URL}" >> $GITHUB_OUTPUT
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

- name: Download lychee
run: curl -sfLO "${{ steps.get-url.outputs.url }}"
run: |
curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ steps.lychee-filename.outputs.tag }}/${{ steps.lychee-filename.outputs.filename }}"
shell: bash

- name: Extract lychee
run: tar -xzf "${{ steps.get-url.outputs.filename }}"
run: |
tar -xvzf "${{ steps.lychee-filename.outputs.filename }}"
shell: bash

- name: Install lychee
run: install -t "$HOME/.local/bin" -D lychee
run: |
install -t "$HOME/.local/bin" -D lychee
shell: bash

- name: Clean up installation files
run: |
# Remove the downloaded archive and any unnecessary files after installation
rm -f "${{ steps.lychee-filename.outputs.filename }}"
shopt -s extglob
rm -f lychee*!(lychee-bin|lychee-lib)
shell: bash

- name: Run Lychee
Expand Down Expand Up @@ -122,14 +134,6 @@ runs:
INPUT_JOBSUMMARY: ${{ inputs.JOBSUMMARY }}
INPUT_OUTPUT: ${{ inputs.OUTPUT }}
shell: bash

- name: Cleanup
if: always()
run: |
rm -f "$HOME/.local/bin/lychee" "${{ steps.get-url.outputs.filename }}"
rm -rf lychee
shell: bash

branding:
icon: "external-link"
color: "purple"

0 comments on commit 0eca6a3

Please sign in to comment.