From 25d273c029a1805b3d23785fe0d57343fdc7a8e7 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Tue, 20 Aug 2024 17:07:59 +0200 Subject: [PATCH 1/7] Test latest lychee version tag --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) 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: From 3b3744127b2d45cebba6528a2d205d62a52564d1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 7 Oct 2024 13:42:17 +0200 Subject: [PATCH 2/7] fix latest tag --- action.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index 6d22d74..c2cd6f1 100644 --- a/action.yml +++ b/action.yml @@ -53,23 +53,22 @@ runs: mkdir -p "$HOME/.local/bin" shell: bash - - name: Determine lychee filename - id: lychee-filename + - name: Determine lychee filename and download URL + id: lychee-info 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. + # This determines the correct filename and download URL 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 + echo "download_url=https://github.com/lycheeverse/lychee/releases/download/${{ inputs.lycheeVersion }}/lychee-${{ inputs.lycheeVersion }}-x86_64-unknown-linux-gnu.tar.gz" >> $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 + if [[ '${{ inputs.lycheeVersion }}' == 'latest' ]]; then + echo "download_url=https://github.com/lycheeverse/lychee/releases/latest/download/lychee-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT + elif [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then + echo "download_url=https://github.com/lycheeverse/lychee/releases/download/nightly/lychee-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT else - echo "tag=lychee-${{ inputs.lycheeVersion }}" >> $GITHUB_OUTPUT + echo "download_url=https://github.com/lycheeverse/lychee/releases/download/lychee-${{ inputs.lycheeVersion }}/lychee-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT fi fi shell: bash @@ -84,7 +83,7 @@ runs: - name: Download lychee run: | - curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ steps.lychee-filename.outputs.tag }}/${{ steps.lychee-filename.outputs.filename }}" + curl -sfLO "${{ steps.lychee-info.outputs.download_url }}" shell: bash - name: Extract lychee From 085cd9373e040bcef78bae506c58e7508250baf0 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Mon, 7 Oct 2024 16:08:57 +0200 Subject: [PATCH 3/7] Update action.yml --- action.yml | 59 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/action.yml b/action.yml index c2cd6f1..207bbc4 100644 --- a/action.yml +++ b/action.yml @@ -53,55 +53,46 @@ runs: mkdir -p "$HOME/.local/bin" shell: bash - - name: Determine lychee filename and download URL - id: lychee-info + - 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 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. 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 "download_url=https://github.com/lycheeverse/lychee/releases/download/${{ inputs.lycheeVersion }}/lychee-${{ inputs.lycheeVersion }}-x86_64-unknown-linux-gnu.tar.gz" >> $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 + FILENAME="lychee-x86_64-unknown-linux-gnu.tar.gz" if [[ '${{ inputs.lycheeVersion }}' == 'latest' ]]; then - echo "download_url=https://github.com/lycheeverse/lychee/releases/latest/download/lychee-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT + DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/latest/download/${FILENAME}" elif [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then - echo "download_url=https://github.com/lycheeverse/lychee/releases/download/nightly/lychee-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT + DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/nightly/${FILENAME}" else - echo "download_url=https://github.com/lycheeverse/lychee/releases/download/lychee-${{ inputs.lycheeVersion }}/lychee-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_OUTPUT + 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 }}" + echo "filename=${FILENAME}" >> $GITHUB_OUTPUT + echo "download_url=${DOWNLOAD_URL}" >> $GITHUB_OUTPUT shell: bash - name: Download lychee - run: | - curl -sfLO "${{ steps.lychee-info.outputs.download_url }}" + run: curl -sfLO "${{ steps.get-url.outputs.url }}" shell: bash - name: Extract lychee - run: | - tar -xvzf "${{ steps.lychee-filename.outputs.filename }}" + run: tar -xzf "${{ steps.get-url.outputs.filename }}" shell: bash - name: Install 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) + run: install -t "$HOME/.local/bin" -D lychee shell: bash - name: Run Lychee @@ -131,6 +122,14 @@ 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" From 9501e47f6ff1e0304bd407c253f9aea69b3d5539 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Mon, 7 Oct 2024 16:11:53 +0200 Subject: [PATCH 4/7] fix path --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 207bbc4..5e315cd 100644 --- a/action.yml +++ b/action.yml @@ -76,7 +76,7 @@ runs: elif [[ '${{ inputs.lycheeVersion }}' == 'nightly' ]]; then DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/nightly/${FILENAME}" else - DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/lychee-${{ inputs.lycheeVersion }}/${FILENAME}" + DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/${{ inputs.lycheeVersion }}/${FILENAME}" fi fi echo "filename=${FILENAME}" >> $GITHUB_OUTPUT From 0eca6a30d08ecb50d5dc91a925333feec1cb9acf Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Mon, 7 Oct 2024 16:18:03 +0200 Subject: [PATCH 5/7] revert --- action.yml | 68 +++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/action.yml b/action.yml index 5e315cd..2310ce9 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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" From 437d088c272d8b30da58ef24045361f544696e04 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Mon, 7 Oct 2024 16:22:31 +0200 Subject: [PATCH 6/7] simplify logic --- action.yml | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) 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 }}" From 617a97f9a33ccb01bb352332d8e07a069fe60254 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Mon, 7 Oct 2024 16:25:22 +0200 Subject: [PATCH 7/7] Update action.yml --- action.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index d313992..55e427e 100644 --- a/action.yml +++ b/action.yml @@ -61,8 +61,8 @@ runs: rm -f "${{ steps.lychee-filename.outputs.filename }}" shell: bash - - name: Determine lychee filename and download - id: lychee-download + - name: Download and extract lychee + id: lychee-setup run: | # Determine filename and download URL based on version if [[ '${{ inputs.lycheeVersion }}' =~ ^v0\.0|^v0\.1[0-5]\. ]]; then @@ -75,24 +75,20 @@ runs: elif [[ '${{ inputs.lycheeVersion }}' == 'latest' ]]; then DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/latest/download/${FILENAME}" else - # 0.16.x and onwards DOWNLOAD_URL="https://github.com/lycheeverse/lychee/releases/download/lychee-${{ inputs.lycheeVersion }}/${FILENAME}" fi fi - # Download lychee + 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: Extract lychee - run: | - tar -xvzf "${{ steps.lychee-filename.outputs.filename }}" - shell: bash - - name: Install lychee run: | install -t "$HOME/.local/bin" -D lychee @@ -101,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