2021-12-19 02:28:46 -08:00
|
|
|
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
|
|
|
|
name: 'Setup Go'
|
|
|
|
description: 'Install Go and override with the custom build'
|
|
|
|
branding:
|
|
|
|
icon: download
|
|
|
|
color: purple
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
2022-12-16 11:47:46 -08:00
|
|
|
- name: Install Go 🚀
|
|
|
|
env:
|
2023-03-12 05:39:39 -07:00
|
|
|
VERSION: "1.20.2"
|
2021-12-19 02:28:46 -08:00
|
|
|
shell: pwsh
|
|
|
|
run: |
|
2022-12-16 11:47:46 -08:00
|
|
|
# Delete conflicting go versions first
|
|
|
|
Remove-Item -Path "$env:RUNNER_TOOL_CACHE/go" -Recurse -Force -ErrorAction Ignore
|
|
|
|
|
|
|
|
# Download source
|
|
|
|
$tempZip = "$env:RUNNER_TEMP/source.zip"
|
|
|
|
Invoke-WebRequest "https://github.com/jandedobbeleer/go/releases/download/$env:VERSION/go.zip" -OutFile $tempZip
|
|
|
|
|
|
|
|
# Extract to correct location
|
|
|
|
Expand-Archive $tempZip -DestinationPath $env:RUNNER_TEMP -Force
|
|
|
|
$sourceFolder = Join-Path $env:RUNNER_TOOL_CACHE "go"
|
|
|
|
New-Item -ItemType Directory -Path $sourceFolder
|
|
|
|
Move-Item "$env:RUNNER_TEMP/go/*" $sourceFolder -Force
|
|
|
|
|
|
|
|
# Set correct permissions on go executables
|
|
|
|
chmod a+x "$sourceFolder/bin/go" 2>&1
|
|
|
|
Get-ChildItem "$sourceFolder/pkg/tool/linux_amd64" | ForEach-Object {
|
|
|
|
chmod a+x $_ 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Add to path
|
|
|
|
"$sourceFolder/bin" >> $env:GITHUB_PATH
|
|
|
|
"GOROOT=$sourceFolder" >> $env:GITHUB_ENV
|
2022-12-17 02:40:51 -08:00
|
|
|
"GOPATH=$sourceFolder" >> $env:GITHUB_ENV
|