-
Notifications
You must be signed in to change notification settings - Fork 793
Add create_release.py script #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,59 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import json | ||
| import os | ||
| import subprocess | ||
| import sys | ||
| from collections import OrderedDict | ||
|
|
||
| script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| root_dir = os.path.dirname(script_dir) | ||
| sys.path.append(root_dir) | ||
|
|
||
| import emsdk # noqa | ||
|
|
||
|
|
||
| def version_to_list(version_string): | ||
| return [int(part) for part in version_string.split('.')] | ||
|
|
||
|
|
||
| def main(args): | ||
| if subprocess.check_output(['git', 'status', '--porcelain'], cwd=root_dir).strip(): | ||
| print('tree is not clean') | ||
| sys.exit(1) | ||
|
|
||
| release_info = emsdk.load_releases_info() | ||
| new_version = version_to_list(release_info['latest']) | ||
| new_version[-1] += 1 | ||
| branch_name = 'version_%s' % '_'.join(str(part) for part in new_version) | ||
|
|
||
| # Create a new git branch | ||
| subprocess.check_call(['git', 'checkout', '-b', branch_name], cwd=root_dir) | ||
|
|
||
| new_version = '.'.join(str(part) for part in new_version) | ||
| new_hash = emsdk.get_emscripten_releases_tot() | ||
| print('Creating new release: %s -> %s' % (new_version, new_hash)) | ||
| release_info['releases'][new_version] = new_hash | ||
| releases = [(k, v) for k, v in release_info['releases'].items()] | ||
| releases.sort(key=lambda pair: version_to_list(pair[0])) | ||
|
|
||
| release_info['releases'] = OrderedDict(reversed(releases)) | ||
| release_info['latest'] = new_version | ||
|
|
||
| with open(os.path.join(root_dir, 'emscripten-releases-tags.txt'), 'w') as f: | ||
| f.write(json.dumps(release_info, indent=2)) | ||
| f.write('\n') | ||
|
|
||
| subprocess.check_call(os.path.join(script_dir, 'update_bazel_workspace.sh'), cwd=root_dir) | ||
|
|
||
| # Create auto-generated changes to the new git branch | ||
| subprocess.check_call(['git', 'add', '-u', '.'], cwd=root_dir) | ||
| subprocess.check_call(['git', 'commit', '-m', new_version], cwd=root_dir) | ||
|
|
||
| print('New relase created in branch: `%s`' % branch_name) | ||
|
|
||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| sys.exit(main(sys.argv[1:])) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't have to be in the first commit, but we should add support for picking a particular revision as the release. Maybe this script could have 2 entry points, one that creates the CL in emscripten-releases to make the build, and another that starts from here and does the rest.