oh-my-posh/.github/workflows/composite/bootstrap-go/action.yml
2023-11-19 10:13:33 +01:00

38 lines
1.3 KiB
YAML

# 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:
- name: Install Go 🚀
env:
VERSION: "1.21.4"
shell: pwsh
run: |
# 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
"GOPATH=$sourceFolder" >> $env:GITHUB_ENV