Repository navigation
Expand file tree
/
Copy pathdorelease.cmd
More file actions
153 lines (121 loc) · 5.1 KB
/
Copy pathdorelease.cmd
File metadata and controls
153 lines (121 loc) · 5.1 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
if NOT DEFINED ClientRevision set ClientRevision=master
if NOT DEFINED KBFSRevision set KBFSRevision=master
if NOT DEFINED UpdaterRevision set UpdaterRevision=master
if NOT DEFINED ReleaseRevision set ReleaseRevision=master
if NOT DEFINED DevCert set DevCert=0
set GOARCH=amd64
set OUTPUT=echo
if DEFINED SlackBot set OUTPUT=cmd /c %KEYBASE_LOCATION% chat send %CHATCHANNEL%
:: sanity check that the passphrase is set right
(cd %GOPATH%\src\github.com\keybase\client\go\tools\ssss\ && go run main.go %0)
IF %ERRORLEVEL% NEQ 0 (
echo Saltpack key not set right, can't build
EXIT /B 1
)
if NOT DEFINED DevEnvDir call "%ProgramFiles(x86)%\\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
:: don't bother with ci or checking out source, etc. for smoke2 build
IF [%UpdateChannel%] == [Smoke2] goto:done_ci
:done_ci
for /F delims^=^"^ tokens^=2 %%x in ('findstr /C:"Version = " %GOPATH%\src\github.com\keybase\client\go\libkb\version.go') do set LIBKB_VER=%%x
:: release
pushd %GOPATH%\src\github.com\keybase\client\go\release
del release.exe
go build
IF %ERRORLEVEL% NEQ 0 (
goto:build_error || EXIT /B 1
)
for /f %%i in ('release winbuildnumber --version=%LIBKB_VER%') do set BUILD_NUMBER=%%i
echo %BUILD_NUMBER%
popd
if NOT DEFINED BUILD_NUMBER (
echo bad build number
goto:build_error || EXIT /B 1
)
:: ensure it's numeric
SET "badbuildnumber="&for /f "delims=0123456789" %%i in ("%BUILD_NUMBER%") do set badbuildnumber=%%i
if defined badbuildnumber (
echo bad build number
goto:build_error || EXIT /B 1
)
call %GOPATH%\src\github.com\keybase\client\packaging\windows\build_prerelease.cmd || goto:build_error || EXIT /B 1
call %GOPATH%\src\github.com\keybase\client\packaging\windows\buildui.cmd || goto:build_error || EXIT /B 1
::Build Installer
call %GOPATH%\src\github.com\keybase\client\packaging\windows\doinstaller_wix.cmd || goto:build_error || EXIT /B 1
::Publish to S3
echo "Uploading %BUILD_TAG%"
s3browser-con upload prerelease.keybase.io %GOPATH%\src\github.com\keybase\client\packaging\windows\%BUILD_TAG%\Keybase_%BUILD_TAG%.%GOARCH%.msi prerelease.keybase.io/windows || goto:build_error || EXIT /B 1
if %UpdateChannel% NEQ "None" (
:: Test channel json
s3browser-con upload prerelease.keybase.io %GOPATH%\src\github.com\keybase\client\packaging\windows\%BUILD_TAG%\update-windows-prod-test-v2.json prerelease.keybase.io || goto:build_error || EXIT /B 1
echo "Creating index files"
%GOPATH%\src\github.com\keybase\client\go\release\release index-html --bucket-name=prerelease.keybase.io --prefixes="windows/" --upload="windows/index.html"
) else (
echo "No update channel"
)
::Invoke SmokeB build
if [%UpdateChannel%] NEQ [Smoke] (
if [%UpdateChannel%] NEQ [SmokeCI] (
echo "Not a smoke build"
goto:no_smokea
)
)
:: Smoke A json
s3browser-con upload prerelease.keybase.io %GOPATH%\src\github.com\keybase\client\packaging\windows\%BUILD_TAG%\*.json prerelease.keybase.io/windows-support || goto:build_error || EXIT /B 1
set PrevUpdateChannel=%UpdateChannel%
set UpdateChannel=Smoke2
set smokeASemVer=%KEYBASE_VERSION%
::SlackBot?
::build again
call %GOPATH%\src\github.com\keybase\client\packaging\windows\dorelease.cmd || EXIT /B 1
:: and we're done here
EXIT /B 0
:no_smokea
::Publish smoke updater jsons to S3
if [%UpdateChannel%] NEQ [Smoke2] (
echo "Non Smoke2 build"
%OUTPUT% "Successfully built Windows with client: %KEYBASE_VERSION%"
%OUTPUT% "Build tag: %BUILD_TAG% GOARCH: %GOARCH%"
%OUTPUT% "https://prerelease.keybase.io/windows/"
goto:no_smokeb
)
::Smoke B json
s3browser-con upload prerelease.keybase.io %GOPATH%\src\github.com\keybase\client\packaging\windows\%BUILD_TAG%\*.json prerelease.keybase.io/windows-support || goto:build_error || EXIT /B 1
set smokeBSemVer=%KEYBASE_VERSION%
%GOPATH%\src\github.com\keybase\client\go\release\release announce-build --build-a="%SmokeASemVer%" --build-b="%smokeBSemVer%" --platform="windows" || goto:build_error || EXIT /B 1
%OUTPUT% "Successfully built Windows: --build-a=%SmokeASemVer% --build-b=%smokeBSemVer%
%OUTPUT% "https://prerelease.keybase.io/windows/"
:no_smokeb
echo %ERRORLEVEL%
goto:eof
:checkout_keybase
if EXIST %GOPATH%\src\github.com\keybase\%~1 goto:repoexists
pushd %GOPATH%\src\github.com\keybase
git clone https://github.com/keybase/%~1.git
popd
:repoexists
pushd %GOPATH%\src\github.com\keybase\%~1
git checkout master || EXIT /B 1
git pull || EXIT /B 1
git checkout %~2 || EXIT /B 1
for /f %%i in ('git rev-parse --abbrev-ref HEAD') do set currentCommit=%%i
if NOT [%currentCommit%] == [HEAD] (
git pull || EXIT /B 1
)
popd
EXIT /B 0
goto:eof
:build_error
%OUTPUT% "Error building Windows"
EXIT /B 1
:check_ci
for /f %%i in ('git -C %GOPATH%\src\github.com\keybase\client rev-parse --short^=8 HEAD') do set clientCommit=%%i
echo [%clientCommit%]
:: need GITHUB_TOKEN
pushd %GOPATH%\src\github.com\keybase\client\go\release
go build || goto:build_error || EXIT /B 1
release wait-ci --repo="client" --commit="%clientCommit%" --context="continuous-integration/jenkins/branch" --context="ci/circleci" || goto:ci_error
popd
EXIT /B 0
:ci_error
%OUTPUT% "CI Failure building Windows"
EXIT /B 1