-
Notifications
You must be signed in to change notification settings - Fork 19
/
appveyor_build.ps1
54 lines (36 loc) · 1.73 KB
/
appveyor_build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
If (Test-Path "buildOutput") {
Remove-Item "buildOutput" -recurse
}
$env:GO111MODULE = "on"
$date = (Get-Date).AddDays(-1).ToString('MM-dd-yyyy_HH:mm:ss')
$version = git rev-parse HEAD
echo "$date - $version"
echo "Building for Windows amd64"
$env:GOOS = "windows"
$env:GOARCH = "amd64"
$winCommand = 'go build -o buildOutput\castro_win_amd64.exe -ldflags "-X github.com/raggaer/castro/app/util.VERSION=$version -X github.com/raggaer/castro/app/util.BUILD_DATE=$date"'
iex $winCommand
echo "Building for Linux amd64"
$env:GOOS = "linux"
$env:GOARCH = "amd64"
$linuxCommand = 'go build -o buildOutput\castro_linux_amd64 -ldflags "-X github.com/raggaer/castro/app/util.VERSION=$version -X github.com/raggaer/castro/app/util.BUILD_DATE=$date"'
iex $linuxCommand
$linuxCommand = 'go build -o buildOutput\castro_linux_arm64 -ldflags "-X github.com/raggaer/castro/app/util.VERSION=$version -X github.com/raggaer/castro/app/util.BUILD_DATE=$date"'
echo "Building for Linux arm64"
$env:GOOS = "linux"
$env:GOARCH = "arm64"
iex $linuxCommand
echo "Creating data directories"
Copy-Item pages buildOutput\data\pages -recurse
Copy-Item widgets buildOutput\data\widgets -recurse
Copy-Item install buildOutput\data\install -recurse
Copy-Item public buildOutput\data\public -recurse
Copy-Item views buildOutput\data\views -recurse
Copy-Item engine buildOutput\data\engine -recurse
Copy-Item migrations buildOutput\data\migrations -recurse
Copy-Item extensions buildOutput\data\extensions -recurse
Copy-Item i18n buildOutput\data\i18n -recurse
Copy-Item LICENSE buildOutput\LICENSE
echo "Compressing data directories"
$files = Get-ChildItem -Path "buildOutput\data\*"
Compress-Archive -Path $files -CompressionLevel Optimal -DestinationPath buildOutput\release.zip