This commit is contained in:
SteVen Batten 2021-09-07 11:54:28 -07:00
Родитель 83d3f572dd
Коммит aa7627b4a3
6 изменённых файлов: 62 добавлений и 14 удалений

1
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
*.exe

Просмотреть файл

@ -23,13 +23,23 @@ steps:
- powershell: |
$env:GOARCH="arm64"
go build -v -o "$(Build.BinariesDirectory)\\vscode-winsta11er-arm64.exe" -ldflags -H=windowsgui
displayName: Build arm64
go build -v -o "$(Build.BinariesDirectory)\\vscode-winsta11er-arm64.exe" -ldflags -H=windowsgui ./stable
displayName: Build arm64 (Stable)
- powershell: |
$env:GOARCH="amd64"
go build -v -o "$(Build.BinariesDirectory)\\vscode-winsta11er-x64.exe" -ldflags -H=windowsgui
displayName: Build x64
go build -v -o "$(Build.BinariesDirectory)\\vscode-winsta11er-x64.exe" -ldflags -H=windowsgui ./stable
displayName: Build x64 (Stable)
- powershell: |
$env:GOARCH="arm64"
go build -v -o "$(Build.BinariesDirectory)\\vscode-winsta11er-insiders-arm64.exe" -ldflags -H=windowsgui ./insiders
displayName: Build arm64 (Insiders)
- powershell: |
$env:GOARCH="amd64"
go build -v -o "$(Build.BinariesDirectory)\\vscode-winsta11er-insiders-x64.exe" -ldflags -H=windowsgui ./insiders
displayName: Build x64 (Insiders)
- task: EsrpCodeSigning@1
inputs:

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
package main
package common
import (
"bytes"
@ -24,11 +24,11 @@ import (
"time"
)
func main() {
func MainBase(quality string) {
arch_pkg := GetSystemInfo()
installer_dir, err := SetupTemporaryDirectory()
installer_dir, err := SetupTemporaryDirectory(quality)
checkError(err)
release_info, err := GetReleaseInfo(arch_pkg)
release_info, err := GetReleaseInfo(arch_pkg, quality)
checkError(err)
installer_path, err := DownloadInstaller(installer_dir, arch_pkg, release_info)
checkError(err)
@ -51,8 +51,8 @@ func GetSystemInfo() (arch_pkg string) {
return
}
func SetupTemporaryDirectory() (installer_dir string, err error) {
return ioutil.TempDir("", "vscode-winsta11er")
func SetupTemporaryDirectory(quality string) (installer_dir string, err error) {
return ioutil.TempDir("", fmt.Sprintf("vscode-winsta11er-%s", quality))
}
type ReleaseInfo struct {
@ -61,8 +61,8 @@ type ReleaseInfo struct {
Sha256Hash string `json:"sha256hash"`
}
func GetReleaseInfo(arch_pkg string) (info *ReleaseInfo, err error) {
apiUrl := fmt.Sprintf("https://update.code.visualstudio.com/api/update/win32-%s/stable/latest", arch_pkg)
func GetReleaseInfo(arch_pkg string, quality string) (info *ReleaseInfo, err error) {
apiUrl := fmt.Sprintf("https://update.code.visualstudio.com/api/update/win32-%s/%s/latest", arch_pkg, quality)
fmt.Printf("Requesting hash from %s.\n", apiUrl)
client := http.Client{
Timeout: 30 * time.Second,

4
go.mod
Просмотреть файл

@ -1,3 +1,3 @@
module main
module github.com/winsta11er
go 1.16
go 1.17

16
insiders/insiders.go Normal file
Просмотреть файл

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
package main
import (
"github.com/winsta11er/common"
)
func main() {
common.MainBase("insider")
}

21
stable/stable.go Normal file
Просмотреть файл

@ -0,0 +1,21 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
package main
import (
"github.com/winsta11er/common"
)
func main() {
common.MainBase("stable")
}