summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2021-07-06 14:01:46 -0700
committerBob Ippolito <bob@redivi.com>2021-07-09 16:07:50 -0700
commit949aeefd17eea3f597bf549af43d007381cc077d (patch)
tree1c7928fddf0202628968605164542a055bd599a0 /scripts
parent8bef979ad8272cbc2903970f4b9992f603d50973 (diff)
downloadsimplejson-949aeefd17eea3f597bf549af43d007381cc077d.tar.gz
Replace travis and appveyor with github actions
Diffstat (limited to 'scripts')
-rw-r--r--scripts/release.py81
1 files changed, 0 insertions, 81 deletions
diff --git a/scripts/release.py b/scripts/release.py
deleted file mode 100644
index 34e23ff..0000000
--- a/scripts/release.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python3
-from urllib.request import urlopen
-
-import json
-import os
-import subprocess
-import sys
-import getpass
-
-
-def get_json(url):
- return json.loads(urlopen(url).read().decode('utf-8'))
-
-
-def download_file(src_url, dest_path):
- print(dest_path)
- subprocess.call(
- ['curl', '-L', '-#', '-o', dest_path, src_url])
-
-
-def download_appveyor_artifacts():
- api_url = 'https://ci.appveyor.com/api'
- builds = get_json(
- '{}/projects/etrepum/simplejson'.format(api_url))
-
- for job in builds['build']['jobs']:
- url = '{api_url}/buildjobs/{jobId}/artifacts'.format(
- api_url=api_url, **job)
- for artifact in get_json(url):
- download_file(
- '{url}/{fileName}'.format(url=url, **artifact),
- artifact['fileName'])
-
-
-def download_github_artifacts():
- release = get_json(
- 'https://api.github.com/repos/simplejson/simplejson/releases/latest')
- for asset in release['assets']:
- download_file(asset['browser_download_url'], 'dist/{name}'.format(**asset))
-
-
-def get_version():
- return subprocess.check_output(
- [sys.executable, 'setup.py', '--version'],
- encoding='utf8'
- ).strip()
-
-
-def artifact_matcher(version):
- prefix = 'simplejson-{}'.format(version)
- def matches(fn):
- return (
- fn.startswith(prefix) and
- fn.endswith('.whl') and
- not fn.endswith('-none-any.whl')
- ) or fn == '{}.tar.gz'.format(prefix)
- return matches
-
-
-def upload_artifacts(version):
- artifacts = set(os.listdir('dist'))
- matches = artifact_matcher(version)
- args = ['twine', 'upload']
- for fn in artifacts:
- if matches(fn):
- args.append(os.path.join('dist', fn))
- subprocess.check_call(args)
-
-
-def main():
- try:
- os.makedirs('dist')
- except OSError:
- pass
- download_appveyor_artifacts()
- download_github_artifacts()
- upload_artifacts(get_version())
-
-
-if __name__ == '__main__':
- main()