From 7da8ec1fc4e01b5a12062ac6c589c10a4ce70d67 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Mon, 7 Oct 2024 16:41:19 +0200 Subject: [PATCH] Test latest lychee version tag (#236) --- .github/workflows/test.yml | 5 ++++ action.yml | 53 ++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd411a6..c43232d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,11 @@ jobs: with: lycheeVersion: nightly + - name: test latest lychee version + uses: ./ + with: + lycheeVersion: latest + - name: test globs uses: ./ with: diff --git a/action.yml b/action.yml index 6d22d74..55e427e 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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 @@ -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