|
1 |
| -@echo off |
2 |
| -REM Copyright (c) 2016-2021 Vegard IT GmbH (https://vegardit.com) and contributors. |
3 |
| -REM SPDX-License-Identifier: Apache-2.0 |
4 |
| -REM Author: Sebastian Thomschke, Vegard IT GmbH |
5 |
| - |
6 |
| -REM creates a new release in GitHub and haxelib.org |
7 |
| - |
8 |
| -where zip.exe /Q |
9 |
| -if %errorlevel% neq 0 ( |
10 |
| - echo Required command 'zip' not found. Download from http://www.info-zip.org/Zip.html#Downloads |
11 |
| - exit /b 1 |
12 |
| -) |
13 |
| - |
14 |
| -where wget.exe /Q |
15 |
| -if %errorlevel% neq 0 ( |
16 |
| - echo Required command 'wget' not found. Download from https://eternallybored.org/misc/wget/ |
17 |
| - exit /b 1 |
18 |
| -) |
19 |
| - |
20 |
| -if [%GITHUB_ACCESS_TOKEN%] == [] ( |
21 |
| - echo Required environment variable GITHUB_ACCESS_TOKEN is not set! |
22 |
| - exit /b 1 |
23 |
| -) |
24 |
| - |
25 |
| -setlocal |
26 |
| -set DRAFT=false |
27 |
| -set PREPRELEASE=false |
28 |
| - |
29 |
| -REM cd into project root |
30 |
| -pushd . |
31 |
| -cd %~dp0.. |
32 |
| - |
33 |
| -REM extract GIT URL from haxelib.json |
34 |
| -for /f "tokens=*" %%a in ( 'findstr url haxelib.json' ) do (set textLine=%%a) |
35 |
| -set REPO_URL=%textLine:"url": "=% |
36 |
| -set REPO_URL=%REPO_URL:",=% |
37 |
| -set REPO_URL=%REPO_URL:"=% |
38 |
| -echo REPO_URL=%REPO_URL% |
39 |
| - |
40 |
| -REM extract repo name from haxelib.json |
41 |
| -set REPO_NAME=%REPO_URL:https://github.com/=% |
42 |
| -echo REPO_NAME=%REPO_NAME% |
43 |
| - |
44 |
| -REM extract project version from haxelib.json |
45 |
| -for /f "tokens=*" %%a in ( 'findstr version haxelib.json' ) do (set textLine=%%a) |
46 |
| -set PROJECT_VERSION=%textLine:"version": "=% |
47 |
| -set PROJECT_VERSION=%PROJECT_VERSION:",=% |
48 |
| -set PROJECT_VERSION=%PROJECT_VERSION:"=% |
49 |
| -echo PROJECT_VERSION=%PROJECT_VERSION% |
50 |
| - |
51 |
| -REM extract release note from haxelib.json |
52 |
| -for /f "tokens=*" %%a in ( 'findstr releasenote haxelib.json' ) do (set textLine=%%a) |
53 |
| -set RELEASE_NOTE=%textLine:"releasenote": "=% |
54 |
| -set RELEASE_NOTE=%RELEASE_NOTE:",=% |
55 |
| -set RELEASE_NOTE=%RELEASE_NOTE:"=% |
56 |
| -echo RELEASE_NOTE=%RELEASE_NOTE% |
57 |
| - |
58 |
| -if not exist target mkdir target |
59 |
| - |
60 |
| -REM create haxelib release |
61 |
| -if exist target\haxelib-upload.zip ( |
62 |
| - del target\haxelib-upload.zip |
63 |
| -) |
64 |
| -echo Building haxelib release... |
65 |
| -zip target\haxelib-upload.zip src haxelib.json LICENSE.txt CONTRIBUTING.md README.md -r -9 || goto :eof |
66 |
| - |
67 |
| -REM create github release https://developer.github.com/v3/repos/releases/#create-a-release |
68 |
| -echo Creating GitHub release https://github.com/%REPO_NAME%/releases/tag/v%PROJECT_VERSION%... |
69 |
| -( |
70 |
| - echo { |
71 |
| - echo "tag_name":"v%PROJECT_VERSION%", |
72 |
| - echo "name":"v%PROJECT_VERSION%", |
73 |
| - echo "target_commitish":"main", |
74 |
| - echo "body":"%RELEASE_NOTE%", |
75 |
| - echo "draft":%DRAFT%, |
76 |
| - echo "prerelease":%PREPRELEASE% |
77 |
| - echo } |
78 |
| -)>target\github_release.json |
79 |
| -wget -qO- --header="Authorization: token %GITHUB_ACCESS_TOKEN%" --post-file=target/github_release.json "https://api.github.com/repos/%REPO_NAME%/releases" || goto :eof |
80 |
| - |
81 |
| -REM submit haxelib release |
82 |
| -echo Submitting haxelib release... |
83 |
| -haxelib submit target\haxelib-upload.zip |
84 |
| - |
85 |
| -:eof |
86 |
| -popd |
87 |
| -endlocal |
| 1 | +@echo off |
| 2 | +REM Copyright (c) 2016-2021 Vegard IT GmbH (https://vegardit.com) and contributors. |
| 3 | +REM SPDX-License-Identifier: Apache-2.0 |
| 4 | +REM Author: Sebastian Thomschke, Vegard IT GmbH |
| 5 | + |
| 6 | +REM creates a new release in GitHub and haxelib.org |
| 7 | + |
| 8 | +where zip.exe /Q |
| 9 | +if %errorlevel% neq 0 ( |
| 10 | + echo Required command 'zip' not found. Download from http://www.info-zip.org/Zip.html#Downloads |
| 11 | + exit /b 1 |
| 12 | +) |
| 13 | + |
| 14 | +where wget.exe /Q |
| 15 | +if %errorlevel% neq 0 ( |
| 16 | + echo Required command 'wget' not found. Download from https://eternallybored.org/misc/wget/ |
| 17 | + exit /b 1 |
| 18 | +) |
| 19 | + |
| 20 | +if [%GITHUB_ACCESS_TOKEN%] == [] ( |
| 21 | + echo Required environment variable GITHUB_ACCESS_TOKEN is not set! |
| 22 | + exit /b 1 |
| 23 | +) |
| 24 | + |
| 25 | +setlocal |
| 26 | +set DRAFT=false |
| 27 | +set PREPRELEASE=false |
| 28 | + |
| 29 | +REM cd into project root |
| 30 | +pushd . |
| 31 | +cd %~dp0.. |
| 32 | + |
| 33 | +REM extract GIT URL from haxelib.json |
| 34 | +for /f "tokens=*" %%a in ( 'findstr url haxelib.json' ) do (set textLine=%%a) |
| 35 | +set REPO_URL=%textLine:"url": "=% |
| 36 | +set REPO_URL=%REPO_URL:",=% |
| 37 | +set REPO_URL=%REPO_URL:"=% |
| 38 | +echo REPO_URL=%REPO_URL% |
| 39 | + |
| 40 | +REM extract repo name from haxelib.json |
| 41 | +set REPO_NAME=%REPO_URL:https://github.com/=% |
| 42 | +echo REPO_NAME=%REPO_NAME% |
| 43 | + |
| 44 | +REM extract project version from haxelib.json |
| 45 | +for /f "tokens=*" %%a in ( 'findstr version haxelib.json' ) do (set textLine=%%a) |
| 46 | +set PROJECT_VERSION=%textLine:"version": "=% |
| 47 | +set PROJECT_VERSION=%PROJECT_VERSION:",=% |
| 48 | +set PROJECT_VERSION=%PROJECT_VERSION:"=% |
| 49 | +echo PROJECT_VERSION=%PROJECT_VERSION% |
| 50 | + |
| 51 | +REM extract release note from haxelib.json |
| 52 | +for /f "tokens=*" %%a in ( 'findstr releasenote haxelib.json' ) do (set textLine=%%a) |
| 53 | +set RELEASE_NOTE=%textLine:"releasenote": "=% |
| 54 | +set RELEASE_NOTE=%RELEASE_NOTE:",=% |
| 55 | +set RELEASE_NOTE=%RELEASE_NOTE:"=% |
| 56 | +echo RELEASE_NOTE=%RELEASE_NOTE% |
| 57 | + |
| 58 | +if not exist target mkdir target |
| 59 | + |
| 60 | +REM create haxelib release |
| 61 | +if exist target\haxelib-upload.zip ( |
| 62 | + del target\haxelib-upload.zip |
| 63 | +) |
| 64 | +echo Building haxelib release... |
| 65 | +zip target\haxelib-upload.zip src extraParams.hxml haxelib.json LICENSE.txt CONTRIBUTING.md README.md -r -9 || goto :eof |
| 66 | + |
| 67 | +REM create github release https://developer.github.com/v3/repos/releases/#create-a-release |
| 68 | +echo Creating GitHub release https://github.com/%REPO_NAME%/releases/tag/v%PROJECT_VERSION%... |
| 69 | +( |
| 70 | + echo { |
| 71 | + echo "tag_name":"v%PROJECT_VERSION%", |
| 72 | + echo "name":"v%PROJECT_VERSION%", |
| 73 | + echo "target_commitish":"main", |
| 74 | + echo "body":"%RELEASE_NOTE%", |
| 75 | + echo "draft":%DRAFT%, |
| 76 | + echo "prerelease":%PREPRELEASE% |
| 77 | + echo } |
| 78 | +)>target\github_release.json |
| 79 | +wget -qO- --header="Authorization: token %GITHUB_ACCESS_TOKEN%" --post-file=target/github_release.json "https://api.github.com/repos/%REPO_NAME%/releases" || goto :eof |
| 80 | + |
| 81 | +REM submit haxelib release |
| 82 | +echo Submitting haxelib release... |
| 83 | +haxelib submit target\haxelib-upload.zip |
| 84 | + |
| 85 | +:eof |
| 86 | +popd |
| 87 | +endlocal |
0 commit comments