:: Destination path - specify where to move package after build SET DEST_PATH=C:\\builds MKDIR "%DEST_PATH%" SET ZIP_EXE="C:\Program Files\7-Zip\7z.exe" SET SQLITE_DIR=C:\\dev\\SQLite-Win64 SET SQLCIPHER_DIR=C:\\git_repos\\SQLCipher-Win64 SET SQLCIPHER_TAG=v4.4.2 :: You need to change the date format in Windows settings to YYYY-MM-DD :: before this will work properly. ;) set RUN_DATE=%DATE% :: If no branch given on the command line, use master IF "%1"=="" (SET BRANCH="master") ELSE (SET BRANCH="%1") CD /d "C:\" if exist "%SQLITE_DIR%" rd /q /s "%SQLITE_DIR%" if exist "C:\\builds\\release-sqlite-win64" rd /q /s "C:\\builds\\release-sqlite-win64" if exist "C:\\builds\\release-sqlcipher-win64" rd /q /s "C:\\builds\\release-sqlcipher-win64" :: Unpack SQLite CD C:\dev %ZIP_EXE% e sqlite*zip "-o%SQLITE_DIR%" :: Update repositories ::git clone -b v3.4.2 https://github.com/sqlcipher/sqlcipher.git SQLCipher-Win64 CD C:\\git_repos\\SQLCipher-Win64 git clean -dffx git checkout -f HEAD git checkout master git pull git checkout "%SQLCIPHER_TAG%" git clean -dffx git pull git clean -dffx ::git clone -b %BRANCH% https://github.com/sqlitebrowser/sqlitebrowser.git "%DB4S_DIR%Win64" CD C:\\git_repos\\sqlitebrowser git clean -dffx git checkout -f HEAD git checkout master git pull git checkout %BRANCH% git clean -dffx git pull git clean -dffx :: Get the current commit hash FOR /F %%A IN ('git rev-parse --verify HEAD') DO SET CURRENT_COMMIT=%%A :: Get the last build commit hash from the server curl -f -L -o commit.txt "https://nightlies.sqlitebrowser.org/win64/commit.txt" :: Save the hash to a variable for comparison IF EXIST "commit.txt" SET /P LAST_COMMIT=C:\\builds\\commit.txt pscp -q -p -i C:\dev\puttygen_private.ppk "%DEST_PATH%\commit.txt" nightlies@nightlies.sqlitebrowser.org:/nightlies/win64 :: Upload the packages to the nightlies server pscp -q -p -i C:\dev\puttygen_private.ppk "%DEST_PATH%\DB*%RUN_DATE%*win64.*" nightlies@nightlies.sqlitebrowser.org:/nightlies/win64 :: Copy the new binaries to /latest directory on the nightlies server plink -i C:\dev\puttygen_private.ppk nightlies@nightlies.sqlitebrowser.org "cd /nightlies/latest; rm -f *-win64.*" plink -i C:\dev\puttygen_private.ppk nightlies@nightlies.sqlitebrowser.org "cp /nightlies/win64/DB*SQLite-%RUN_DATE%-win64.msi /nightlies/latest/DB.Browser.for.SQLite-win64.msi" plink -i C:\dev\puttygen_private.ppk nightlies@nightlies.sqlitebrowser.org "cp /nightlies/win64/DB*SQLite-%RUN_DATE%-win64.zip /nightlies/latest/DB.Browser.for.SQLite-win64.zip"