Skip to content

Commit

Permalink
Test latest lychee version tag (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
mre authored Oct 7, 2024
1 parent 6cba5a9 commit 7da8ec1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
with:
lycheeVersion: nightly

- name: test latest lychee version
uses: ./
with:
lycheeVersion: latest

- name: test globs
uses: ./
with:
Expand Down
53 changes: 25 additions & 28 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,6 @@ runs:
mkdir -p "$HOME/.local/bin"
shell: bash

- 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 based on the version string.
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
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.
if [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then
echo "tag=${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT
else
echo "tag=lychee-${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT
fi
fi
shell: bash

- name: Clean up existing lychee files
run: |
# Remove any existing lychee binaries or archives to prevent conflicts
Expand All @@ -82,14 +61,32 @@ runs:
rm -f "${{ steps.lychee-filename.outputs.filename }}"
shell: bash

- name: Download lychee
- name: Download and extract lychee
id: lychee-setup
run: |
curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ steps.lychee-filename.outputs.tag }}/${{ steps.lychee-filename.outputs.filename }}"
shell: bash
# Determine filename and download URL based on version
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}"
else
FILENAME="lychee-x86_64-unknown-linux-gnu.tar.gz"
if [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then
DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/nightly/${FILENAME}"
elif [[ '${{ inputs.lycheeVersion }}' == 'latest' ]]; then
DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/latest/download/${FILENAME}"
else
DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/lychee-${{ inputs.lycheeVersion }}/${FILENAME}"
fi
fi
- name: Extract lychee
run: |
tar -xvzf "${{ steps.lychee-filename.outputs.filename }}"
echo "Downloading from: ${DOWNLOAD_URL}"
curl -sfLO "${DOWNLOAD_URL}"
echo "Extracting ${FILENAME}"
tar -xvzf "${FILENAME}"
# Output filename for use in later steps
echo "filename=${FILENAME}" >> $GITHUB_OUTPUT
shell: bash

- name: Install lychee
Expand All @@ -100,7 +97,7 @@ runs:
- name: Clean up installation files
run: |
# Remove the downloaded archive and any unnecessary files after installation
rm -f "${{ steps.lychee-filename.outputs.filename }}"
rm -f "${{ steps.lychee-setup.outputs.filename }}"
shopt -s extglob
rm -f lychee*!(lychee-bin|lychee-lib)
shell: bash
Expand Down

0 comments on commit 7da8ec1

Please sign in to comment.