forked from spicetify/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.ps1
62 lines (45 loc) · 4.5 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
$curVer = [regex]::Match((Get-Content ".\spicetify.go"), "version = `"([\d\.]*)`"").Captures.Groups[1].Value
Write-Host "Current version: $curVer"
function BumpVersion {
param (
[Parameter(Mandatory = $true)][int16]$major,
[Parameter(Mandatory = $true)][int16]$minor,
[Parameter(Mandatory = $true)][int16]$patch
)
$ver = "$($major).$($minor).$($patch)"
(Get-Content ".\spicetify.go") -replace "version = `"[\d\.]*`"", "version = `"$($ver)`"" |
Set-Content ".\spicetify.go"
}
function Dist {
param (
[Parameter(Mandatory = $true)][int16]$major,
[Parameter(Mandatory = $true)][int16]$minor,
[Parameter(Mandatory = $true)][int16]$patch
)
BumpVersion $major $minor $patch
$nameVersion = "spicetify-$($major).$($minor).$($patch)"
$env:GOARCH = "amd64"
if (Test-Path "./bin") {
Remove-Item -Recurse "./bin"
}
Write-Host "Building Linux binary:"
$env:GOOS = "linux"
go build -o "./bin/linux/spicetify"
7z a -bb0 "./bin/linux/$($nameVersion)-linux-amd64.tar" "./bin/linux/*" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" >$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"
go build -o "./bin/darwin/spicetify"
7z a -bb0 "./bin/darwin/$($nameVersion)-darwin-amd64.tar" "./bin/darwin/*" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" >$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"
go build -o "./bin/windows/spicetify.exe"
7z a -bb0 -mx9 "./bin/$($nameVersion)-windows-x64.zip" "./bin/windows/*" "./CustomApps" "./Extensions" "./Themes" "./jsHelper" "globals.d.ts" >$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
}