Skip to content

Commit

Permalink
fix: installation script with curl 8.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jun 12, 2024
1 parent 528d713 commit 5575515
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:

main:
name: Main Process
check-code:
name: Check code
runs-on: ubuntu-latest
env:
GO_VERSION: stable
Expand Down Expand Up @@ -44,3 +44,13 @@ jobs:
- name: Make
run: make

check-local-install-script:
name: Installation script (local)
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check installation script
run: cat ./install-misspell.sh | sh -s -- -d -b "./install-misspell"
9 changes: 4 additions & 5 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ on:
- published

jobs:
install:
name: Install script
check-install-script:
name: Installation script (remote)
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
# os: [ubuntu-latest, macos-latest, windows-latest] # windows has a problem when curl use `%{http_code}`, it returns 000 instead of 200.
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- run: curl -sSfL https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b "./bin-misspell"
- run: curl -sSfL https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b "./install-misspell"
20 changes: 20 additions & 0 deletions install-misspell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@ http_download_curl() {
local_file=$1
source_url=$2
header=$3

# workaround https://github.com/curl/curl/issues/13845
curl_version=$(curl --version | head -n 1 | awk '{ print $2 }')
if [ "$curl_version" = "8.8.0" ]; then
log_debug "http_download_curl curl $curl_version detected"
if [ -z "$header" ]; then
curl -sL -o "$local_file" "$source_url"
else
curl -sL -H "$header" -o "$local_file" "$source_url"

nf=$(cat "$local_file" | jq -r '.error // ""')
if [ ! -z "$nf" ]; then
log_debug "http_download_curl received an error: $nf"
return 1
fi
fi

return 0
fi

if [ -z "$header" ]; then
code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
else
Expand Down

0 comments on commit 5575515

Please sign in to comment.