Skip to content

Commit

Permalink
Add build script for cross-platform releases
Browse files Browse the repository at this point in the history
  • Loading branch information
MosheRivkin committed Nov 30, 2024
1 parent d900e68 commit f7a64ce
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
dist
release
28 changes: 28 additions & 0 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

$version = "v1.0.0"
$platforms = @(
@{GOOS="windows"; GOARCH="amd64"; Suffix=".exe"},
@{GOOS="windows"; GOARCH="386"; Suffix=".exe"},
@{GOOS="linux"; GOARCH="amd64"; Suffix=""},
@{GOOS="linux"; GOARCH="386"; Suffix=""},
@{GOOS="darwin"; GOARCH="amd64"; Suffix=""},
@{GOOS="darwin"; GOARCH="arm64"; Suffix=""}
)

New-Item -ItemType Directory -Force -Path "release"

foreach ($platform in $platforms) {
$env:GOOS = $platform.GOOS
$env:GOARCH = $platform.GOARCH

$output = "release/secgen_${version}_$($platform.GOOS)_$($platform.GOARCH)$($platform.Suffix)"
Write-Host "Building for $($platform.GOOS) $($platform.GOARCH)..."

go build -o $output main.go
}

Set-Location release
Get-ChildItem -Filter "secgen_*" | ForEach-Object {
$hash = Get-FileHash -Algorithm SHA256 $_.Name
"$($hash.Hash) $($_.Name)" | Out-File -Append -FilePath "checksums.txt"
}

0 comments on commit f7a64ce

Please sign in to comment.