Build xray-plugin

This commit is contained in:
Netch
2021-09-12 23:08:57 +08:00
parent 3d15f727f3
commit c686315ee0
3 changed files with 19 additions and 25 deletions

View File

@@ -0,0 +1,19 @@
Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
git clone https://github.com/teddysun/xray-plugin src
if ( -Not $? ) {
Pop-Location
exit $lastExitCode
}
Push-Location src
$Env:CGO_ENABLED='0'
$Env:GOROOT_FINAL='/usr'
$Env:GOOS='windows'
$Env:GOARCH='amd64'
go build -a -trimpath -asmflags '-s -w' -ldflags '-s -w' -o '..\..\release\xray-plugin.exe'
Pop-Location
Pop-Location
exit $lastExitCode

View File

View File

@@ -1,25 +0,0 @@
param (
[string]
$OutputPath
)
try {
Invoke-WebRequest `
-Uri 'https://github.com/teddysun/xray-plugin/releases/download/v1.4.2/xray-plugin-windows-amd64-v1.4.2.tar.gz' `
-OutFile 'xray-plugin.tar.gz'
}
catch {
exit 1
}
7z x 'xray-plugin.tar.gz'
if ( -Not $? ) { exit $lastExitCode }
7z x 'xray-plugin.tar'
if ( -Not $? ) { exit $lastExitCode }
mv -Force 'xray-plugin_windows_amd64.exe' "$OutputPath\xray-plugin.exe"
rm -Force 'xray-plugin.tar'
rm -Force 'xray-plugin.tar.gz'
exit 0