mirror of
https://code.forgejo.org/actions/go-versions
synced 2025-07-06 16:45:59 +02:00
Implement builders to build Go from source code
This commit is contained in:
parent
8c06ab5f1e
commit
6cf25b0561
21 changed files with 836 additions and 0 deletions
35
installers/win-setup-template.ps1
Normal file
35
installers/win-setup-template.ps1
Normal file
|
@ -0,0 +1,35 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
[version]$Version = "{{__VERSION__}}"
|
||||
[string]$Architecture = "{{__ARCHITECTURE__}}"
|
||||
|
||||
$ToolcacheRoot = $env:AGENT_TOOLSDIRECTORY
|
||||
if ([string]::IsNullOrEmpty($ToolcacheRoot)) {
|
||||
# GitHub images don't have `AGENT_TOOLSDIRECTORY` variable
|
||||
$ToolcacheRoot = $env:RUNNER_TOOL_CACHE
|
||||
}
|
||||
$GoToolcachePath = Join-Path -Path $ToolcacheRoot -ChildPath "go"
|
||||
$GoToolcacheVersionPath = Join-Path -Path $GoToolcachePath -ChildPath $Version.ToString()
|
||||
$GoToolcacheArchitecturePath = Join-Path $GoToolcacheVersionPath $Architecture
|
||||
|
||||
Write-Host "Check if Go hostedtoolcache folder exist..."
|
||||
if (-not (Test-Path $GoToolcachePath)) {
|
||||
New-Item -ItemType Directory -Path $GoToolcachePath | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Delete Go $Version if installed"
|
||||
if (Test-Path $GoToolcacheVersionPath) {
|
||||
Remove-Item $GoToolcachePath -Recurse -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Create Go $Version folder"
|
||||
if (-not (Test-Path $GoToolcacheArchitecturePath)) {
|
||||
New-Item -ItemType Directory -Path $GoToolcacheArchitecturePath | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Copy Go binaries to hostedtoolcache folder"
|
||||
Copy-Item -Path * -Destination $GoToolcacheArchitecturePath -Recurse
|
||||
Remove-Item $GoToolcacheArchitecturePath\setup.ps1 -Force | Out-Null
|
||||
|
||||
Write-Host "Create complete file"
|
||||
New-Item -ItemType File -Path $GoToolcacheVersionPath -Name "$Architecture.complete" | Out-Null
|
Loading…
Add table
Add a link
Reference in a new issue