fix: setup go correctly in bootstrap

This commit is contained in:
Jan De Dobbeleer 2022-12-16 20:47:46 +01:00 committed by Jan De Dobbeleer
parent ee13e9c50e
commit 175e5ece04
2 changed files with 32 additions and 9 deletions

View file

@ -27,3 +27,10 @@ jobs:
version: latest version: latest
args: build --rm-dist --snapshot --skip-post-hooks --skip-before args: build --rm-dist --snapshot --skip-post-hooks --skip-before
workdir: src workdir: src
- name: Archive production artifacts
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: builds
retention-days: 1
path: |
src/dist

View file

@ -7,14 +7,30 @@ branding:
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: Install Go - name: Install Go 🚀
uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f env:
with: VERSION: "1.19.4"
go-version: 1.19.4
- name: Override Go ♻️
shell: pwsh shell: pwsh
run: | run: |
$goBin = $(Get-Command go).Source # Delete conflicting go versions first
Invoke-WebRequest 'https://github.com/jandedobbeleer/go/releases/download/1.19.4/go' -OutFile "$goBin" Remove-Item -Path "$env:RUNNER_TOOL_CACHE/go" -Recurse -Force -ErrorAction Ignore
chmod a+x $goBin 2>&1
go version # 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