File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ npm ci
2
+ npm run build
3
+
4
+ $build_dir = " build"
5
+ if (Test-Path $build_dir ){
6
+ Remove-Item - Force - Recurse $build_dir
7
+ }
8
+ New-Item - Name $build_dir - ItemType " directory"
9
+
10
+ $importpath = " github.com/scutrobotlab/asuwave/helper"
11
+ $gittag = $ (git describe -- tags -- abbrev= 0 )
12
+ $build_prefix = " asuwave_"
13
+ $os_list = " linux" , " darwin" , " windows"
14
+ $arch_list = " amd64" , " arm64"
15
+ $flags = " -w -s -X '${importpath} .GitTag=${gittag} ' -X '${importpath} .GitHash=$ ( git describe -- tags -- long) ' -X '${importpath} .BuildTime=$ ( Get-Date - Format ' yyyy-MM-dd HH:mm' ) ' -X '${importpath} .GoVersion=$ ( go version) '"
16
+
17
+ foreach ($os in $os_list ) {
18
+ foreach ($arch in $arch_list ) {
19
+ $suffix = " "
20
+ if ($os -eq " windows" ) {
21
+ if ($arch -eq " arm64" ){
22
+ continue
23
+ }else {
24
+ $suffix = " .exe"
25
+ }
26
+ }
27
+ $file = " ${build_dir} \${build_prefix}${gittag} _${os} _${arch} "
28
+ $out = " ${build_dir} \${build_prefix}${os} _${arch}${suffix} "
29
+ $Env: CGO_ENABLED = 0
30
+ $Env: GOOS = ${os}
31
+ $Env: GOARCH = ${arch}
32
+ go build - tags release - ldflags= " $flags " - o $out
33
+ upx - q -9 $out
34
+ Compress-Archive - CompressionLevel " Optimal" - Path $out - DestinationPath " ${file} .zip"
35
+ }
36
+ }
37
+
You can’t perform that action at this time.
0 commit comments