Beispiel #1
0
def create_tag_for_package_version(package_version_id):
    package_version = PackageVersion.objects.get(pk=package_version_id)
    internalpackage = InternalPackage.objects.get(
        pk=package_version.package.pk)
    github = GitHubHelper(internalpackage.owner, internalpackage.git_repo.name)
    github.create_release(package_version.version_nr,
                          package_version.version_nr,
                          package_version.changelog,
                          package_version.pre_release)
Beispiel #2
0
def experiment_generate_uuid_and_make_public(request, pk, slug):
    """Publishes an experiment by generating a unique ID of length 32,
    setting the experiment public, creating a Git release and saving the GitHub release URL"""
    experiment = verify_and_get_experiment(request, pk)
    if not experiment.unique_id:
        experiment.unique_id = get_random_string(32)
        experiment.public = True
        experiment.save()
        # create github release
        github_helper = GitHubHelper(experiment.owner, experiment.git_repo.name)
        tag_name = 'release_{0}'.format(experiment.unique_id)
        git_release = github_helper.create_release(tag_name=tag_name, name=experiment.title,
                                     body='This is an automatically created release by the MOOC workbench',
                                     pre_release=False)
        experiment.publish_url_zip = git_release.html_url
        # https://github.com/PyGithub/PyGithub/pull/522#pullrequestreview-22171287
        # once merged and released, change this to zipball_url pls kthxby
        experiment.save()
    return redirect(to=reverse('experiment_readonly', kwargs={'unique_id': experiment.unique_id}))