-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #276 from ihsoft/next
Release v1.16
- Loading branch information
Showing
14 changed files
with
89 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Public domain license. | ||
# Author: [email protected] | ||
# GitHub: https://github.com/ihsoft/KSPDev/tree/master/Sources/ReleaseBuilder | ||
# GitHub: https://github.com/ihsoft/KSPDev_ReleaseBuilder | ||
SCRIPT_VERSION = "2.1" # (check if SUPPORTED_JSON_SCHEMA_VERSION needs to be updated!) | ||
|
||
# A very simple class to produce a .ZIP archive with a KSP mod distribution. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Public domain license. | ||
# Author: [email protected] | ||
# GitHub: https://github.com/ihsoft/KSPDev_ReleaseBuilder | ||
# $version: 2 | ||
# $date: 10/16/2018 | ||
# $version: 4 | ||
# $date: 10/28/2018 | ||
|
||
""" Script to publish releases to Kerbal CurseForge. | ||
|
@@ -72,6 +72,7 @@ | |
import textwrap | ||
|
||
from clients import CurseForgeClient | ||
from utils import ChangelogUtils | ||
|
||
|
||
LOGGER = logging.getLogger() | ||
|
@@ -138,6 +139,10 @@ def main(argv): | |
default='.+?_(v.+?)\\.zip', | ||
help='''the RegExp to extract the version tag from the archive name. | ||
[Default: %(default)s]''') | ||
parser.add_argument( | ||
'--github', action='store', metavar='<GitHub>', | ||
help='''the GitHub project and user, separated by "/" symbol. Used when | ||
expanding the GitHub links. Example: "ihsoft/KIS"''') | ||
opts = vars(parser.parse_args(argv[1:])) | ||
|
||
project_id = opts['project'] | ||
|
@@ -166,7 +171,10 @@ def main(argv): | |
print 'ERROR: No versions found for RegExp: %s' % versions_re | ||
exit(-1) | ||
|
||
desc = _ExtractDescription(opts['changelog'], opts['changelog_breaker']) | ||
desc = ChangelogUtils.ExtractDescription( | ||
opts['changelog'], opts['changelog_breaker']) | ||
if opts['github']: | ||
desc = ChangelogUtils.ProcessGitHubLinks(desc, opts['github']) | ||
filename = opts['archive'] | ||
|
||
if opts['title']: | ||
|
@@ -219,20 +227,4 @@ def _Shutdown(): | |
logging.shutdown() | ||
|
||
|
||
def _ExtractDescription(changelog_file, breaker_re): | ||
"""Helper method to extract the meaningful part of the release changelog.""" | ||
with open(changelog_file, 'r') as f: | ||
lines= f.readlines() | ||
changelog = '' | ||
for line in lines: | ||
# Ignore any trailing empty lines. | ||
if not changelog and not line.strip(): | ||
continue | ||
# Stop at the breaker. | ||
if re.match(breaker_re, line.strip()): | ||
break | ||
changelog += line | ||
return changelog.strip() | ||
|
||
|
||
main(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Public domain license. | ||
# Author: [email protected] | ||
# GitHub: https://github.com/ihsoft/KSPDev_ReleaseBuilder | ||
# $version: 1 | ||
# $date: 07/17/2018 | ||
# $version: 2 | ||
# $date: 10/28/2018 | ||
|
||
""" Script to publish releases to GitHub. | ||
|
@@ -11,7 +11,7 @@ | |
Example: | ||
$ PublishCurseForge.py\ | ||
$ PublishGitHub.py\ | ||
--user=my_github_user\ | ||
--repo=MyGitHubMod\ | ||
--token=1111111111122222222222222333333333333333\ | ||
|
@@ -40,7 +40,7 @@ | |
Not to mention the quotes and back slashes issues. To avoid all this burden, | ||
simple put all the options into a text file and provide it to the script: | ||
$ PublishCurseForge.py @my_params.txt | ||
$ PublishGitHub.py @my_params.txt | ||
Don't bother about escaping in this file. Anything, placed in a line goes to | ||
the parameter value *as-is*. So you don't need to escape backslashes, | ||
|
@@ -67,6 +67,7 @@ | |
import textwrap | ||
|
||
from clients import GitHubClient | ||
from utils import ChangelogUtils | ||
|
||
|
||
LOGGER = logging.getLogger() | ||
|
@@ -136,10 +137,11 @@ def main(argv): | |
user = opts['user'] | ||
repo = opts['repo'] | ||
|
||
# Init CurseForge client. | ||
# Init GitHub client. | ||
GitHubClient.API_TOKEN = opts['token'] | ||
|
||
desc = _ExtractDescription(opts['changelog'], opts['changelog_breaker']) | ||
desc = ChangelogUtils.ExtractDescription( | ||
opts['changelog'], opts['changelog_breaker']) | ||
filename = opts['archive'] | ||
as_draft = opts['as_draft'] | ||
|
||
|
@@ -190,22 +192,6 @@ def _Shutdown(): | |
logging.shutdown() | ||
|
||
|
||
def _ExtractDescription(changelog_file, breaker_re): | ||
"""Helper method to extract the meaningful part of the release changelog.""" | ||
with open(changelog_file, 'r') as f: | ||
lines= f.readlines() | ||
changelog = '' | ||
for line in lines: | ||
# Ignore any trailing empty lines. | ||
if not changelog and not line.strip(): | ||
continue | ||
# Stop at the breaker. | ||
if re.match(breaker_re, line.strip()): | ||
break | ||
changelog += line | ||
return changelog.strip() | ||
|
||
|
||
try: | ||
main(sys.argv) | ||
except Exception, ex: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Public domain license. | ||
# Author: [email protected] | ||
# GitHub: https://github.com/ihsoft/KSPDev_ReleaseBuilder | ||
# $version: 1 | ||
# $date: 07/13/2018 | ||
# $version: 5 | ||
# $date: 10/28/2018 | ||
|
||
""" Script to publish releases to Spacedock. | ||
|
@@ -62,6 +62,7 @@ | |
import textwrap | ||
|
||
from clients import SpacedockClient | ||
from utils import ChangelogUtils | ||
|
||
|
||
LOGGER = logging.getLogger() | ||
|
@@ -90,7 +91,7 @@ def main(argv): | |
parser.add_argument( | ||
'--project', action='store', metavar='<project ID>', required=True, | ||
help='''the ID of the project to publish to. To get it, go to the mod | ||
overview on Spacedock and extarct the number from the URL: | ||
overview on Spacedock and extract the number from the URL: | ||
/mod/<project ID>/...''') | ||
parser.add_argument( | ||
'--changelog', action='store', metavar='<file path>', required=True, | ||
|
@@ -125,6 +126,10 @@ def main(argv): | |
'--pass', action='store', metavar='<SD password>', | ||
help='''the password for the Spacedock account. If not set, then it will | ||
be asked in the command line.''') | ||
parser.add_argument( | ||
'--github', action='store', metavar='<GitHub>', | ||
help='''the GitHub project and user, separated by "/" symbol. Used when | ||
expanding the GitHub links. Example: "ihsoft/KIS"''') | ||
opts = vars(parser.parse_args(argv[1:])) | ||
|
||
mod_id = opts['project'] | ||
|
@@ -149,7 +154,10 @@ def main(argv): | |
exit(-1) | ||
game_version = all_versions[0]['name'] | ||
|
||
desc = _ExtractDescription(opts['changelog'], opts['changelog_breaker']) | ||
desc = ChangelogUtils.ExtractDescription( | ||
opts['changelog'], opts['changelog_breaker']) | ||
if opts['github']: | ||
desc = ChangelogUtils.ProcessGitHubLinks(desc, opts['github']) | ||
filename = opts['archive'] | ||
|
||
parts = re.findall(opts['version_extract'], os.path.basename(filename)) | ||
|
@@ -214,20 +222,4 @@ def _Shutdown(): | |
logging.shutdown() | ||
|
||
|
||
def _ExtractDescription(changelog_file, breaker_re): | ||
"""Helper method to extract the meaningful part of the release changelog.""" | ||
with open(changelog_file, 'r') as f: | ||
lines= f.readlines() | ||
changelog = '' | ||
for line in lines: | ||
# Ignore any trailing empty lines. | ||
if not changelog and not line.strip(): | ||
continue | ||
# Stop at the breaker. | ||
if re.match(breaker_re, line.strip()): | ||
break | ||
changelog += line | ||
return changelog.strip() | ||
|
||
|
||
main(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--project=228561 | ||
--token=<<SECRET>> | ||
--changelog=../CHANGELOG.md | ||
--github=ihsoft/KIS | ||
--versions=latest_all_builds | ||
--title=KIS {tag} | ||
--archive=../KIS_v1.15.zip | ||
--archive=../KIS_v1.16.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
--changelog=../CHANGELOG.md | ||
--as_draft | ||
--title=KIS v{tag} | ||
--archive=../KIS_v1.15.zip | ||
--archive=../KIS_v1.16.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--project=1909 | ||
--login=<<SECRET>> | ||
--changelog=../CHANGELOG.md | ||
--github=ihsoft/KIS | ||
--ksp_version=latest | ||
--archive=../KIS_v1.15.zip | ||
--archive=../KIS_v1.16.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Public domain license. | ||
# Author: [email protected] | ||
# GitHub: https://github.com/ihsoft/KSPDev_ReleaseBuilder | ||
# $version: 1 | ||
# $date: 10/28/2018 | ||
|
||
"""Provides helpers to deal with the markup CHANGELOG file.""" | ||
import re | ||
|
||
|
||
def ExtractDescription(changelog_file, breaker_re): | ||
"""Loads the file and extarcts the lines up to the specified breaker.""" | ||
with open(changelog_file, 'r') as f: | ||
lines= f.readlines() | ||
changelog = '' | ||
for line in lines: | ||
# Ignore any trailing empty lines. | ||
if not changelog and not line.strip(): | ||
continue | ||
# Stop at the breaker. | ||
if re.match(breaker_re, line.strip()): | ||
break | ||
changelog += line | ||
return changelog.strip() | ||
|
||
|
||
def ProcessGitHubLinks(markup, github): | ||
"""Replaces the GitHub local links by the external variants.""" | ||
markup = re.sub( | ||
r'#(\d+)', | ||
r'[#\1](https://github.com/%s/issues/\1)' % github, | ||
markup) | ||
markup = re.sub( | ||
r'\[(.+?)\]\((wiki/.+?)\)', | ||
r'[\1](https://github.com/%s/\2)' % github, | ||
markup) | ||
return markup |