forked from spicetify/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.ps1
63 lines (45 loc) · 5.02 KB
/
task.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
53
54
55
56
57
58
59
60
61
62
63
$curVer = Invoke-WebRequest -UseBasicParsing "https://api.github.com/repos/khanhas/spicetify-cli/releases/latest" | ConvertFrom-Json
Write-Host "Current version:", $curVer.tag_name
function Dist {
param (
[Parameter(Mandatory = $true)][int16]$major,
[Parameter(Mandatory = $true)][int16]$minor,
[Parameter(Mandatory = $true)][int16]$patch
)
$version = "$($major).$($minor).$($patch)"
$nameVersion = "spicetify-$version"
$env:GOARCH = "amd64"
function build($dest) {
go build -ldflags "-X main.version=$version" -o $dest
}
if (Test-Path "./bin") {
Remove-Item -Recurse "./bin"
}
Write-Host "Building Linux binary:"
$env:GOOS = "linux"
build "./bin/linux/spicetify"
7z a -bb0 "./bin/linux/$($nameVersion)-linux-amd64.tar" "./bin/linux/*" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" "css-map.json" >$null 2>&1
7z a -bb0 -sdel -mx9 "./bin/$($nameVersion)-linux-amd64.tar.gz" "./bin/linux/$($nameVersion)-linux-amd64.tar" >$null 2>&1
Write-Host "✔" -ForegroundColor Green
Write-Host "Building MacOS binary:"
$env:GOOS = "darwin"
build "./bin/darwin/spicetify"
7z a -bb0 "./bin/darwin/$($nameVersion)-darwin-amd64.tar" "./bin/darwin/*" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" "css-map.json" >$null 2>&1
7z a -bb0 -sdel -mx9 "./bin/$($nameVersion)-darwin-amd64.tar.gz" "./bin/darwin/$($nameVersion)-darwin-amd64.tar" >$null 2>&1
Write-Host "✔" -ForegroundColor Green
Write-Host "Building Windows binary:"
$env:GOOS = "windows"
build "./bin/windows/spicetify.exe"
7z a -bb0 -mx9 "./bin/$($nameVersion)-windows-x64.zip" "./bin/windows/*" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" "css-map.json" >$null 2>&1
Write-Host "✔" -ForegroundColor Green
$env:GOARCH = "arm64"
Write-Host "Building MacOS ARM binary:"
$env:GOOS = "darwin"
build "./bin/darwin-arm/spicetify"
7z a -bb0 "./bin/darwin-arm/$($nameVersion)-darwin-arm64.tar" "./bin/darwin-arm/*" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" "css-map.json" >$null 2>&1
7z a -bb0 -sdel -mx9 "./bin/$($nameVersion)-darwin-arm64.tar.gz" "./bin/darwin-arm/$($nameVersion)-darwin-arm64.tar" >$null 2>&1
Write-Host "✔" -ForegroundColor Green
}
function Format {
prettier --print-width 80 --tab-width 4 --trailing-comma es5 --arrow-parens always --write .\Extensions\*.js
}