Merge pull request #2833 from BOINC/win_deploy_bintray_for_pr

[AppVeyor] Deploy to Bintray Implementation
This commit is contained in:
Christian Beer 2018-11-26 19:26:04 +01:00 committed by GitHub
commit 466c5871fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 125 additions and 7 deletions

View File

@ -62,6 +62,8 @@ environment:
solution_name: win_build\boinc_vs2013.sln
depends_git_path: http://boinc.berkeley.edu/git/boinc_depends_win_vs2013.git
depends_path: C:\projects\boinc_depends_win_vs2013
BINTRAY_API_KEY:
secure: kZI9k0Kh2bFSCbXfkz+J16fGNAee1ToRMl10D8QPQsKpC2PqhF/uVMpd6gRC+OSI
cache:
- C:\projects\boinc_depends_win_vs2013 -> appveyor.yml, win_build\load_dependencies.bat
@ -75,6 +77,7 @@ build_script:
after_build:
- call deploy\prepare_deployment.bat
- call deploy\deploy_to_bintray.bat
artifacts:
- path: deploy\win-apps\*.7z

View File

@ -0,0 +1,94 @@
setlocal EnableDelayedExpansion
rem @echo off
if not defined bintray_deploy (
set bintray_deploy=False
)
if !bintray_deploy! == False (
goto :EOF
)
if not defined BINTRAY_API_KEY (
goto :EOF
)
if [%BINTRAY_API_KEY%] == [] (
goto :EOF
)
set API=https://api.bintray.com
if not defined BINTRAY_USER (
set BINTRAY_USER=ChristianBeer
)
if not defined BINTRAY_REPO (
set BINTRAY_REPO=boinc-ci
)
rem owner and user not always the same
if not defined BINTRAY_REPO_OWNER (
set BINTRAY_REPO_OWNER=boinc
)
if not defined WEBSITE_URL (
set WEBSITE_URL=https://boinc.berkeley.edu
)
if not defined ISSUE_TRACKER_URL (
set ISSUE_TRACKER_URL=https://github.com/BOINC/boinc/issues
)
rem Mandatory for packages in free Bintray repos
if not defined VCS_URL (
set VCS_URL=https://github.com/BOINC/boinc.git
)
set CURL=curl -u%BINTRAY_USER%:%BINTRAY_API_KEY% -H Accept:application/json -w \n
rem use this for local debugging
rem set CURL=echo
if not defined pkg_name (
set pkg_name=custom
)
if not defined pkg_desc (
set pkg_desc=Automated CI build of BOINC components
)
echo Creating package %pkg_name%...
set data={\"name\": \"!pkg_name!\", \"desc\": \"!pkg_desc!\", \"desc_url\": \"auto\", \"website_url\": [\"%WEBSITE_URL%\"], \"vcs_url\": [\"%VCS_URL%\"], \"issue_tracker_url\": [\"%ISSUE_TRACKER_URL%\"], \"licenses\": [\"LGPL-3.0\"]}
%CURL% -H Content-Type:application/json -X POST -d "%data%" "%API%/packages/%BINTRAY_REPO_OWNER%/%BINTRAY_REPO%"
for /f "tokens=2-4 delims=/ " %%a in ("%date%") do (set MM=%%a& set DD=%%b& set YYYY=%%c)
if not defined build_date (
set build_date=%YYYY%-%MM%-%DD%
)
if not defined git_rev (
set git_rev=%APPVEYOR_REPO_COMMIT:~0,8%
)
if not defined pkg_version (
set pkg_version=custom_%build_date%_!git_rev!
)
if not defined pkg_version_desc (
set pkg_version_desc=Custom build created on %build_date%
)
echo Creating version !pkg_version!...
set data={\"name\": \"!pkg_version!\", \"desc\": \"!pkg_version_desc!\"}
%CURL% -H Content-Type:application/json -X POST -d "%data%" "%API%/packages/%BINTRAY_REPO_OWNER%/%BINTRAY_REPO%/!pkg_name!/versions"
if exist "deploy\win-apps\win-apps_!pkg_version!.7z" (
echo Uploading and publishing "deploy\win-apps\win-apps_!pkg_version!.7z"
%CURL% -H Content-Type:application/octet-stream -T "deploy\win-apps\win-apps_!pkg_version!.7z" "%API%/content/%BINTRAY_REPO_OWNER%/%BINTRAY_REPO%/!pkg_name!/!pkg_version!/win-apps_!pkg_version!.7z?publish=1&override=1"
)
if exist "deploy\win-client\win-client_!pkg_version!.7z" (
echo Uploading and publishing "deploy\win-client\win-client_!pkg_version!.7z"
%CURL% -H Content-Type:application/octet-stream -T "deploy\win-client\win-client_!pkg_version!.7z" "%API%/content/%BINTRAY_REPO_OWNER%/%BINTRAY_REPO%/!pkg_name!/!pkg_version!/win-client_!pkg_version!.7z?publish=1&override=1"
)
if exist "deploy\win-manager\win-manager_!pkg_version!.7z" (
echo Uploading and publishing "deploy\win-manager\win-manager_!pkg_version!.7z"
%CURL% -H Content-Type:application/octet-stream -T "deploy\win-manager\win-manager_!pkg_version!.7z" "%API%/content/%BINTRAY_REPO_OWNER%/%BINTRAY_REPO%/!pkg_name!/!pkg_version!/win-manager_!pkg_version!.7z?publish=1&override=1"
)
rem if defined APPVEYOR_JOB_ID (
rem echo Adding AppVeyor log to release notes...
rem set BUILD_LOG=https://ci.appveyor.com/api/buildjobs/%APPVEYOR_JOB_ID%/log
rem set data='{"bintray": {"syntax": "markdown", "content": "'%BUILD_LOG%'"}}'
rem %CURL% -H Content-Type:application/json -X POST -d "%data%" "%API%/packages/%BINTRAY_REPO_OWNER%/%BINTRAY_REPO%/!pkg_name!/versions/!pkg_version!/release_notes"
rem )
:EOF

View File

@ -1,24 +1,27 @@
setlocal EnableDelayedExpansion
rem @echo off
set bintray_deploy=False
for /f "tokens=2-4 delims=/ " %%a in ("%date%") do (set MM=%%a& set DD=%%b& set YYYY=%%c)
set build_date=%YYYY%-%MM%-%DD%
set git_rev=%APPVEYOR_REPO_COMMIT:~0,8%
rem Default values because %bintray_deploy% is currently unused
set pkg_name=master
set git_rev=%APPVEYOR_REPO_COMMIT:~0,8%
set pkg_version=master_%build_date%_%git_rev%
set pkg_version=master_%build_date%_!git_rev!
set pkg_version_desc=Custom build created on %build_date%
if defined APPVEYOR_PULL_REQUEST_NUMBER (
set pkg_name=pull-requests
set git_rev=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT:~0,8%
set pkg_version=PR%APPVEYOR_PULL_REQUEST_NUMBER%_%build_date%_%git_rev%
set pkg_version=PR%APPVEYOR_PULL_REQUEST_NUMBER%_%build_date%_!git_rev!
set pkg_version_desc=CI build created from PR #%APPVEYOR_PULL_REQUEST_NUMBER% on %build_date%
set bintray_deploy=True
)
if defined APPVEYOR_SCHEDULED_BUILD (
if "%APPVEYOR_SCHEDULED_BUILD%" == "True" (
set pkg_name=weekly
set pkg_version=weekly_%build_date%_%git_rev%
set pkg_version=weekly_%build_date%_!git_rev!
set pkg_version_desc=Weekly CI build created on %build_date%
set bintray_deploy=True
)
)
@ -35,7 +38,7 @@ copy "win_build\Build\%platform%\%configuration%\example_app.exe" "deploy\win-ap
copy "win_build\Build\%platform%\%configuration%\worker.exe" "deploy\win-apps\"
copy "win_build\Build\%platform%\%configuration%\sleeper.exe" "deploy\win-apps\"
cd deploy\win-apps
7z a win-apps_%pkg_version%.7z *.exe
7z a win-apps_!pkg_version!.7z *.exe
cd ..\..
if not exist "deploy\win-client" mkdir deploy\win-client
@ -45,12 +48,30 @@ copy "win_build\Build\%platform%\%configuration%\boinccmd.exe" "deploy\win-clien
copy "win_build\Build\%platform%\%configuration%\boincscr.exe" "deploy\win-client\"
copy "win_build\Build\%platform%\%configuration%\boinc.scr" "deploy\win-client\"
cd deploy\win-client
7z a win-client_%pkg_version%.7z *.exe *.scr
7z a win-client_!pkg_version!.7z *.exe *.scr
cd ..\..
if not exist "deploy\win-manager" mkdir deploy\win-manager
copy "win_build\Build\%platform%\%configuration%\boinctray.exe" "deploy\win-manager\"
copy "win_build\Build\%platform%\%configuration%\boincmgr.exe" "deploy\win-manager\"
cd deploy\win-manager
7z a win-manager_%pkg_version%.7z *.exe
7z a win-manager_!pkg_version!.7z *.exe
cd ..\..
rem setlocal mode is very 'interesting'
rem see https://stackoverflow.com/questions/33898076/passing-variable-out-of-setlocal-code for details
(
endlocal
set "bintray_deploy=%bintray_deploy%"
set "pkg_name=%pkg_name%"
set "git_rev=%git_rev%"
set "pkg_version=%pkg_version%"
set "pkg_version_desc=%pkg_version_desc%"
)
set bintray_deploy
set pkg_name
set git_rev
set pkg_version
set pkg_version_desc