|
| 1 | +REM -------------------------------------------------------------------------------------------------------------------------- |
| 2 | +REM ========== Guidelines =============== |
| 3 | +REM |
| 4 | +REM ------------------------------------- |
| 5 | +REM ---- Common Environment Variable ---- |
| 6 | +REM ------------------------------------- |
| 7 | +REM ${Package_Publish} (boolean): Indicates whether it is build package process, e.g. If you want to get one CI SDK package. |
| 8 | +REM ${Clean_Clone} (boolean): Indicates whether it is clean build. If true, CI will clean ${output} for each build process. |
| 9 | +REM ${is_tag_fetch} (boolean): If true, git checkout will work as tag fetch mode. |
| 10 | +REM ${is_official_build} (boolean): Indicates whether it is official build release. |
| 11 | +REM ${arch} (string): Indicates build arch set in build pipeline. |
| 12 | +REM ${short_version} (string): CI auto generated short version string. |
| 13 | +REM ${release_version} (string): CI auto generated version string. |
| 14 | +REM ${build_date} (string(yyyyMMdd)): Build date generated by CI. |
| 15 | +REM ${build_timestamp} (string (yyyyMMdd_hhmm)): Build timestamp generated by CI. |
| 16 | +REM ${platform} (string): Build platform generated by CI. |
| 17 | +REM ${BUILD_NUMBER} (string): Build number generated by CI. |
| 18 | +REM ${WORKSPACE} (string): Working dir generated by CI. |
| 19 | +REM |
| 20 | +REM ------------------------------------- |
| 21 | +REM ------- Job Custom Parameters ------- |
| 22 | +REM ------------------------------------- |
| 23 | +REM If you added one custom parameter via rehoboam website, e.g. extra_args. |
| 24 | +REM You could use $extra_args to get its value. |
| 25 | +REM |
| 26 | +REM ------------------------------------- |
| 27 | +REM ------------- Input ----------------- |
| 28 | +REM ------------------------------------- |
| 29 | +REM ${source_root}: Source root which checkout the source code. |
| 30 | +REM ${WORKSPACE}: project owned private workspace. |
| 31 | +REM |
| 32 | +REM ------------------------------------- |
| 33 | +REM ------------- Output ---------------- |
| 34 | +REM ------------------------------------- |
| 35 | +REM Generally, we should put the output files into %WORKSPACE% |
| 36 | +REM 1. for pull request: Output files should be zipped to test.zip, and then copy to %WORKSPACE%. |
| 37 | +REM 2. for pull request (options): Output static xml should be static_%platform%.xml, and then copy to %WORKSPACE%. |
| 38 | +REM 3. for others: Output files should be zipped to anything_you_want.zip, and then copy it to %WORKSPACE%. |
| 39 | +REM |
| 40 | +REM ------------------------------------- |
| 41 | +REM --------- Avaliable Tools ----------- |
| 42 | +REM ------------------------------------- |
| 43 | +REM Compressing & Decompressing: 7z a, 7z x |
| 44 | +REM |
| 45 | +REM ------------------------------------- |
| 46 | +REM ----------- Test Related ------------ |
| 47 | +REM ------------------------------------- |
| 48 | +REM PR build, zip test related to test.zip |
| 49 | +REM Package build, zip package related to package.zip |
| 50 | +REM |
| 51 | +REM ------------------------------------- |
| 52 | +REM ------ Publish to artifactory ------- |
| 53 | +REM ------------------------------------- |
| 54 | +REM [Download] artifacts from artifactory: |
| 55 | +REM python3 ${WORKSPACE}/artifactory_utils.py --action=download_file --file=ARTIFACTORY_URL |
| 56 | +REM |
| 57 | +REM [Upload] artifacts to artifactory: |
| 58 | +REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --project |
| 59 | +REM Sample Code: |
| 60 | +REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --project |
| 61 | +REM |
| 62 | +REM [Upload] artifacts folder to artifactory |
| 63 | +REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --project --with_folder |
| 64 | +REM Sample Code: |
| 65 | +REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=./folder --project --with_folder |
| 66 | +REM |
| 67 | +REM ========== Guidelines END============== |
| 68 | +REM -------------------------------------------------------------------------------------------------------------------------- |
| 69 | + |
| 70 | +echo Package_Publish: %Package_Publish% |
| 71 | +echo is_tag_fetch: %is_tag_fetch% |
| 72 | +echo arch: %arch% |
| 73 | +echo source_root: %source_root% |
| 74 | +echo output: C:\\tmp\\%project%_out |
| 75 | +echo build_date: %build_date% |
| 76 | +echo build_time: %build_time% |
| 77 | +echo release_version: %release_version% |
| 78 | +echo short_version: %short_version% |
| 79 | +echo pwd: %cd% |
| 80 | + |
| 81 | + |
| 82 | +echo isBuildSdk: %isBuildSdk% |
| 83 | +echo isBuildDemo: %isBuildDemo% |
| 84 | +echo Upload_CDN: %Upload_CDN% |
| 85 | +echo example_electron_version: %example_electron_version% |
| 86 | +echo example_sdk_mode: %example_sdk_mode% |
| 87 | +echo arch: %arch% |
| 88 | +echo package_version: %package_version% |
| 89 | + |
| 90 | +git config --system core.longpaths true |
| 91 | +call npm config delete ELECTRON_MIRROR |
| 92 | +call npm config delete electron_mirror |
| 93 | +call npm config delete artifactory_api_key |
| 94 | +call npm config delete ARTIFACTORY_API_KEY |
| 95 | + |
| 96 | +echo npm config list |
| 97 | +call npm config list |
| 98 | + |
| 99 | +del /a /f /s *.zip |
| 100 | +del /a /f /s Electron-SDK |
| 101 | +del /a /f /s example\dist |
| 102 | + |
| 103 | +pushd ..\Electron-SDK |
| 104 | + |
| 105 | +if %isBuildSdk% == true ( |
| 106 | + |
| 107 | + call ci\electron-sdk-build-windows-release.bat %arch% |
| 108 | + echo 执行上传electron.zip到artifactory |
| 109 | + echo path:%WORKSPACE%\\%build_time%_windows_%arch%.zip |
| 110 | + copy electron.zip %WORKSPACE%\%build_time%_windows_%package_version%_%arch%.zip |
| 111 | + |
| 112 | + if %Upload_CDN% == true ( |
| 113 | + @REM electron.zip |
| 114 | + @REM 执行上传SDK到CDN |
| 115 | + echo 执行上传electron.zip到CDN |
| 116 | + ) |
| 117 | +) |
| 118 | + |
| 119 | +if %example_sdk_mode% == 1 ( |
| 120 | + 7z x electron.zip -o.\Electron-SDK\ -y |
| 121 | +) |
| 122 | + |
| 123 | +if %isBuildDemo% == true ( |
| 124 | + echo isBuildDemo: %isBuildDemo% |
| 125 | + call powershell.exe -executionpolicy remotesigned -File ci\packager-win.ps1 %arch% %example_sdk_mode% %example_electron_version% |
| 126 | + @REM electronDemo.zip |
| 127 | + @REM 执行上传到artifactory |
| 128 | + echo 执行上传electronDemo.zip到artifactory |
| 129 | + copy electronDemo.zip %WORKSPACE%\\%build_time%_windows_electron_demo_%package_version%_%arch%.zip |
| 130 | +) |
| 131 | + |
| 132 | +echo 全部完成 |
| 133 | + |
| 134 | +popd |
0 commit comments