-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Download pre-built Go tip from grafana/gotip repo #7447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
2a26119
e5db70f
8337b48
690a2a9
df4a742
6f04e0a
d71af21
c0caeb7
ec16c7b
6bd288a
fbeff7c
d15b5d9
a2e66a4
6d70c8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,51 +1,70 @@ | ||||||||||||||
| # Inspired by https://github.com/actions/setup-go/issues/21#issuecomment-997208686 | ||||||||||||||
| name: 'Install Go Tip' | ||||||||||||||
| description: 'Install Go Tip toolchain' | ||||||||||||||
| inputs: | ||||||||||||||
| gh_token: | ||||||||||||||
| description: 'The GitHub Token' | ||||||||||||||
| required: true | ||||||||||||||
| runs: | ||||||||||||||
| using: "composite" | ||||||||||||||
| steps: | ||||||||||||||
| - name: Download Go Tip | ||||||||||||||
| id: download | ||||||||||||||
| shell: bash | ||||||||||||||
| run: | | ||||||||||||||
| echo Download Go Tip | ||||||||||||||
| set -euo pipefail | ||||||||||||||
| tip=$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}') | ||||||||||||||
| echo "Go Tip version: ${tip}" | ||||||||||||||
| retries=3 | ||||||||||||||
| wait_time=10 | ||||||||||||||
| success=false | ||||||||||||||
| for ((i=1; i<=retries; i++)); do | ||||||||||||||
| url="https://storage.googleapis.com/go-build-snap/go/linux-amd64/${tip}.tar.gz" | ||||||||||||||
| if curl -fsSL -o gotip.tar.gz "$url"; then | ||||||||||||||
| success=true | ||||||||||||||
| break | ||||||||||||||
| fi | ||||||||||||||
| echo "Failed to download. Retrying in $wait_time seconds..." | ||||||||||||||
| sleep $wait_time | ||||||||||||||
| done | ||||||||||||||
| echo "success=${success}" >> $GITHUB_OUTPUT | ||||||||||||||
| # - name: Download Go Tip | ||||||||||||||
| # id: download | ||||||||||||||
| # shell: bash | ||||||||||||||
| # run: | | ||||||||||||||
| # set -euo pipefail | ||||||||||||||
| # tip=$(git ls-remote https://github.com/golang/go.git refs/heads/master | awk '{print $1;}') | ||||||||||||||
| # echo "Go Tip version: ${tip}" | ||||||||||||||
| # retries=3 | ||||||||||||||
| # wait_time=10 | ||||||||||||||
| # success=false | ||||||||||||||
| # for ((i=1; i<=retries; i++)); do | ||||||||||||||
| # url="https://storage.googleapis.com/go-build-snap/go/linux-amd64/${tip}.tar.gz" | ||||||||||||||
| # if curl -fsSL -o gotip.tar.gz "$url"; then | ||||||||||||||
| # success=true | ||||||||||||||
| # break | ||||||||||||||
| # fi | ||||||||||||||
| # echo "Failed to download. Retrying in $wait_time seconds..." | ||||||||||||||
| # sleep $wait_time | ||||||||||||||
| # done | ||||||||||||||
| # echo "success=${success}" >> $GITHUB_OUTPUT | ||||||||||||||
|
|
||||||||||||||
| - name: Unpack gotip bundle | ||||||||||||||
| if: steps.download.outputs.success == 'true' | ||||||||||||||
| # - name: Unpack gotip bundle | ||||||||||||||
| # if: steps.download.outputs.success == 'true' | ||||||||||||||
| # shell: bash | ||||||||||||||
| # run: | | ||||||||||||||
| # echo Unpack gotip bundle | ||||||||||||||
| # set -euo pipefail | ||||||||||||||
| # echo "Downloaded bundle:" | ||||||||||||||
| # ls -lah gotip.tar.gz | ||||||||||||||
| # export GOROOT="$HOME/sdk/gotip" | ||||||||||||||
| # mkdir -p $GOROOT | ||||||||||||||
| # tar -C $GOROOT -xzf gotip.tar.gz | ||||||||||||||
| # echo "GOROOT=$GOROOT" >> $GITHUB_ENV | ||||||||||||||
|
|
||||||||||||||
| - name: Download pre-built Go tip from grafana/gotip repo | ||||||||||||||
| id: download | ||||||||||||||
| shell: bash | ||||||||||||||
| run: | | ||||||||||||||
| echo Unpack gotip bundle | ||||||||||||||
| set -euo pipefail | ||||||||||||||
| echo "Downloaded bundle:" | ||||||||||||||
| ls -lah gotip.tar.gz | ||||||||||||||
| gh release download ubuntu-latest --repo grafana/gotip --pattern 'go*.zip' | ||||||||||||||
| unzip go.zip -d $HOME/sdk | ||||||||||||||
| export GOROOT="$HOME/sdk/gotip" | ||||||||||||||
| mkdir -p $GOROOT | ||||||||||||||
| tar -C $GOROOT -xzf gotip.tar.gz | ||||||||||||||
| echo "GOROOT=$GOROOT" >> $GITHUB_ENV | ||||||||||||||
| # echo "GOPATH=$HOME/go" >> "$GITHUB_ENV" | ||||||||||||||
| # echo "$HOME/go/bin" >> "$GITHUB_PATH" | ||||||||||||||
| # echo "$HOME/sdk/gotip/bin" >> "$GITHUB_PATH" | ||||||||||||||
| echo "success=${success}" >> $GITHUB_OUTPUT | ||||||||||||||
|
||||||||||||||
| echo "success=${success}" >> $GITHUB_OUTPUT | |
| success=false | |
| if gh release download ubuntu-latest --repo grafana/gotip --pattern 'go*.zip' && unzip go.zip -d $HOME/sdk; then | |
| success=true | |
| fi | |
| echo "success=${success}" >> $GITHUB_OUTPUT |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
Uh oh!
There was an error while loading. Please reload this page.