Calls the GitHub Release API to tag release and upload optional
distribution asset
770871
function gitHubRelease() {
			rbot.log.info('Releasing ' + commit.versionTag + ' via ' + options.gitHostname);
			// GitHub Release API will not remove the tag when removing a
			// release
			github.releaseAndUploadAsset(distAssets, coopt.regexLines, commit, tmpltData.name, chgLogRtn
					|| commit.message, options, rollCall, rollbackTag, function() {
				rollCall.then(publish);
			});
		}
1312492
def release(ctx, deploy=False, test=False, version=''):
    
    if test:
        run("python setup.py check")
        run("python setup.py register sdist upload --dry-run")

    if deploy:
        run("python setup.py check")
        if version:
            run("git checkout master")
            run("git tag -a v{ver} -m 'v{ver}'".format(ver=version))
            run("git push")
            run("git push origin --tags")
            run("python setup.py sdist bdist_wheel")
            run("twine upload --skip-existing dist/*")
    else:
        print("- Have you updated the version?")
        print("- Have you updated CHANGELOG.md, README.md, and AUTHORS.md?")
        print("- Have you fixed any last minute bugs?")
        print("- Have you merged changes for release into the master branch?")
        print("If you answered yes to all of the above questions,")
        print("then run `inv release --deploy -vX.YY.ZZ` to:")
        print("- Checkout master")
        print("- Tag the git release with provided vX.YY.ZZ version")
        print("- Push the master branch and tags to repo")
602107
async function deploy() {
  // Initialize a new repository
  await makeDir('build');
  await spawn('git', ['init', '--quiet'], options);

  // Changing a remote's URL
  let isRemoteExists = false;
  try {
    await spawn(
      'git',
      ['config', '--get', `remote.${remote.name}.url`],
      options,
    );
    isRemoteExists = true;
  } catch (error) {
    /* skip */
  }
  await spawn(
    'git',
    ['remote', isRemoteExists ? 'set-url' : 'add', remote.name, remote.url],
    options,
  );

  // Fetch the remote repository if it exists
  let isRefExists = false;
  try {
    await spawn(
      'git',
      ['ls-remote', '--quiet', '--exit-code', remote.url, remote.branch],
      options,
    );
    isRefExists = true;
  } catch (error) {
    await spawn('git', ['update-ref', '-d', 'HEAD'], options);
  }
  if (isRefExists) {
    await spawn('git', ['fetch', remote.name], options);
    await spawn(
      'git',
      ['reset', `${remote.name}/${remote.branch}`, '--hard'],
      options,
    );
    await spawn('git', ['clean', '--force'], options);
  }

  // Build the project in RELEASE mode which
  // generates optimized and minimized bundles
  process.argv.push('--release');
  if (remote.static) process.argv.push('--static');
  await run(require('./build').default); // eslint-disable-line global-require
  if (process.argv.includes('--static')) {
    await cleanDir('build/*', {
      nosort: true,
      dot: true,
      ignore: ['build/.git', 'build/public'],
    });
    await moveDir('build/public', 'build');
  }

  // Push the contents of the build folder to the remote server via Git
  await spawn('git', ['add', '.', '--all'], options);
  try {
    await spawn('git', ['diff', '--cached', '--exit-code', '--quiet'], options);
  } catch (error) {
    await spawn(
      'git',
      ['commit', '--message', `Update ${new Date().toISOString()}`],
      options,
    );
  }
  await spawn(
    'git',
    ['push', remote.name, `master:${remote.branch}`, '--set-upstream'],
    options,
  );

  // Check if the site was successfully deployed
  const response = await fetch(remote.website);
  console.info(
    `${remote.website} => ${response.status} ${response.statusText}`,
  );
}
569724
def prepare_release(ver=None):
    """"""
    write_changelog(True)
    if ver is None:
        ver = next_release()
    print('saving updates to ChangeLog')
    run('git commit ChangeLog -m "[RELEASE] Update to version v{}"'.format(ver), hide=True)
    sha = run('git log -1 --pretty=format:"%h"', hide=True).stdout
    run('git tag -a "{ver}" -m "version {ver}" {sha}'.format(ver=ver, sha=sha), hide=True)
    package()
    write_changelog()
    run('git tag -d {}'.format(ver), hide=True)
    run('git commit --all --amend --no-edit', hide=True)
724645
def gh_release(name = nil, options = {})
      if name.is_a?(Hash)
        options, name = name, nil
      end

      source = options.fetch(:source)
      tag = options.fetch(:tag)
      remote_source = RemoteSources::GithubRelease.new(source, tag)

      name ||= remote_source.repository_name
      packages << Package.new(name, remote_source, options)
    end
200273
def publish():
    """"""
    print("To be ready for release, remember:")
    print("      1) Update the version number (and associated test)")
    print("      2) Update the ChangeLog.rst (and other documentation)")
    print(
        "         ChangeLog should have an line (title) consisting of the version number"
    )
    print("      3) Tag Mercurial with 'Release <version>'")
    print("      4) Push updates to BitBucket")
    print("      5) Set the RELEASE environment variable")
    print("           $ export RELEASE=formic")

    cmd = [
        'bash', '-c',
        'yolk -M formic | grep "^version: " | sed "s/^version: \\(.*\\)$/\\1/"'
    ]
    published_version = subprocess.check_output(cmd).strip()
    our_version = open(os.path.join("formic", "VERSION.txt"), "r").read()

    # sanity test on version
    if "\n" in published_version or\
       len(published_version) < 3 or len(published_version) > 10:
        raise Exception(
            "Published version number seems weird: " + published_version)

    print("Published version:", published_version)
    print("Current version:  ", our_version)

    if our_version == published_version:
        raise Exception(
            "You are attempting to republish version " + our_version)

    # sanity: check ChangeLog starts with our version
    changelog = open("CHANGELOG.rst", "r")
    found = False
    for line in changelog.readlines():
        if line.strip() == our_version:
            print("ChangeLog has an entry")
            found = True
            break
    changelog.close()
    if not found:
        raise Exception(
            "The ChangeLog does not appear to include comments on this release"
        )

    # Sanity check: is there a release tag
    tags = subprocess.check_output("hg tags".split())
    found = False
    looking_for = "Release " + our_version
    for line in tags.split("\n"):
        match = re.match(r"^(.*)\s+[0-9]+:[0-9a-f]+$", line)
        if match:
            tag = match.group(1).strip()
            if tag == looking_for:
                print("Found tag", tag)
                found = True
                break

    if not found:
        raise Exception(
            "Mercurial does not have the release tag: " + looking_for)

    status = subprocess.check_output(["hg", "status"])
    for line in status.split("\n"):
        if len(line) > 0:
            raise Exception("Uncommitted changes present")

    try:
        v = os.environ["RELEASE"]
        if v != "formic":
            raise KeyError()
    except KeyError:
        print("$RELEASE environment variable is not set")
        raise

    subprocess.check_call("python setup.py bdist_egg upload".split())
    subprocess.check_call("python setup.py sdist upload".split())
144560
def pre_release(version):
    """"""
    create_branch(version)
    changelog(version, write_out=True)

    check_call(["git", "commit", "-a", "-m", f"Preparing release {version}"])

    print()
    print(f"{Fore.GREEN}Please push your branch to your fork and open a PR.")
1334064
def upload_GitHub_deploy_key(deploy_repo, ssh_key, *, read_only=False,
    title="Doctr deploy key for pushing to gh-pages from Travis", **login_kwargs):
    
    DEPLOY_KEY_URL = "https://api.github.com/repos/{deploy_repo}/keys".format(deploy_repo=deploy_repo)

    data = {
        "title": title,
        "key": ssh_key,
        "read_only": read_only,
    }
    return GitHub_post(data, DEPLOY_KEY_URL, **login_kwargs)
525757
def get_files_from_github(user_and_repo, filedir, regex, prefer_tags):
    '''  '''
    github_url = f'https://api.github.com/repos/{user_and_repo}'
    args = f'?per_page={N_RESULTS}'
    results = []
    json_data = None

    # Determine the right url
    if not prefer_tags:
        url = f'{github_url}/releases{args}'
        json_data = requests.get(url).json()

    if not json_data:
        url = f'{github_url}/tags{args}'
        json_data = requests.get(url).json()

    logger.debug(f'[+] Using {url} as base url.')

    # Get all the releases/tags available
    results = json_data
    for n_page in range(2, 1000):
        logger.debug(f'[+] Requesting page {n_page} of releases/tags ..')
        json_data = requests.get(f'{url}&page={n_page}').json()
        results += json_data

        if len(json_data) < N_RESULTS:
            break

    if not results:
        raise ValueError(f'No releases/tags for {user_and_repo}')

    directories = {}
    for result in results:
        name = result['name']
        m = re.match(regex, name)
        if not m:
            continue

        name = m.groups()[0]

        logger.debug(f'[+] Downloading zip file for {name} version ..')

        # Download zip file and extract in temporary directory
        zip_url = result['zipball_url']
        zf = requests.get(zip_url, allow_redirects=True)
        z = zipfile.ZipFile(io.BytesIO(zf.content))
        output_dir = f'{filedir}/{z.namelist()[0]}'

        z.extractall(path=filedir)
        directories[name] = output_dir

    return directories
657233
function generateRelease() {
    ReleaseOps.generateRelease();
    const releaseInfo = JSON.parse(cat(".eslint-release-info.json"));

    echo("Generating site");
    target.gensite();
    generateBlogPost(releaseInfo);
    commitSiteToGit(`v${releaseInfo.version}`);
}
305192
def release():
    ""
    sh("paver bdist_wheel")
    wheels = path("dist").files("*.whl")
    if not wheels:
        error("\n*** ERROR: No release wheel was built!")
        sys.exit(1)
    if any(".dev" in i for i in wheels):
        error("\n*** ERROR: You're still using a 'dev' version!")
        sys.exit(1)

    # Check that source distribution can be built and is complete
    print('')
    print("~" * 78)
    print("TESTING SOURCE BUILD")
    sh( "{ command cd dist/ && unzip -q %s-%s.zip && command cd %s-%s/"
        "  && /usr/bin/python setup.py sdist >/dev/null"
        "  && if { unzip -ql ../%s-%s.zip; unzip -ql dist/%s-%s.zip; }"
        "        | cut -b26- | sort | uniq -c| egrep -v '^ +2 +' ; then"
        "       echo '^^^ Difference in file lists! ^^^'; false;"
        "    else true; fi; } 2>&1"
        % tuple([project["name"], version] * 4)
    )
    path("dist/%s-%s" % (project["name"], version)).rmtree()
    print("~" * 78)

    print('')
    print("Created", " ".join([str(i) for i in path("dist").listdir()]))
    print("Use 'paver sdist bdist_wheel' to build the release and")
    print("    'twine upload dist/*.{zip,whl}' to upload to PyPI")
    print("Use 'paver dist_docs' to prepare an API documentation upload")
39256
function performRelease() {
  return gulp.src([config.pkg, config.dist])
      .pipe(git.add({args: '-f'}))
      .pipe(git.commit('release: release version'));
}
991196
function releaseTheme(theme, version) {
  const repoPath = `.tmp/${version}/${theme}/publish`
  return setupThemeRepo(theme, version)
    .then(() => {
      console.log(chalk.blue('Committing changes...'))
      return new Promise((resolve, reject) => {
        // commit changes
        git.add(['css', 'js', 'fonts', 'bower.json', 'package.json'], (err) =>{
          if (err) return reject(err)
          git.commit(`${version} upgrade :arrow_up:`, ['.'], (err, res) => {
            if (err) return reject(err)
            // tag current version (3.3.7-cerulean)
            git.addTag(cleanVersion(version) + '-' + theme, (err) => {
              if (err) return reject(err)
              console.log(chalk.blue('Pushing commit...'))
              // push commit
              git.push('origin', theme, (err) => {
                if (err) return reject(err)
                console.log(chalk.blue('Pushing tag...'))
                // push new tag
                git.pushTags('origin', (err) => {
                  if (err) return reject(err)
                  console.log(chalk.green(`${theme} published.`))
                  resolve()
                })
              })
            })
          })
        })
      })
    })
}
1186864
def release():
    
    sh("paver bdist_egg")

    # Check that source distribution can be built and is complete
    print
    print "~" * 78
    print "TESTING SOURCE BUILD"
    sh(
        "{ cd dist/ && unzip -q %s-%s.zip && cd %s-%s/"
        "  && /usr/bin/python setup.py sdist >/dev/null"
        "  && if { unzip -ql ../%s-%s.zip; unzip -ql dist/%s-%s.zip; }"
        "        | cut -b26- | sort | uniq -c| egrep -v '^ +2 +' ; then"
        "       echo '^^^ Difference in file lists! ^^^'; false;"
        "    else true; fi; } 2>&1"
        % tuple([project["name"], version] * 4)
    )
    path("dist/%s-%s" % (project["name"], version)).rmtree()
    print "~" * 78

    print
    print "Created", " ".join([str(i) for i in path("dist").listdir()])
    print "Use 'paver sdist bdist_egg upload' to upload to PyPI"
    print "Use 'paver dist_docs' to prepare an API documentation upload"
679102
def get_release(self, id):
        
        if isinstance(id, int):
            headers, data = self._requester.requestJsonAndCheck(
                "GET",
                self.url + "/releases/" + str(id)
            )
            return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)
        elif isinstance(id, (str, unicode)):
            headers, data = self._requester.requestJsonAndCheck(
                "GET",
                self.url + "/releases/tags/" + id
            )
            return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)
746847
function finishRelease() {

  log.done();
  execSync("npm run examples", {stdio: "inherit"});
  execSync("npm run docs", {stdio: "inherit"});
  let commits = "", releaseUrl = "", zipSize = 0;

  log.timer("compiling release notes");
  execAsync("git log --pretty=format:'* %s (%h)' `git describe --tags --abbrev=0`...HEAD")
    .then(stdout => {
      commits = stdout;
      log.timer("publishing npm package");
      return execAsync("npm publish ./");
    })
    .then(() => {
      log.timer("commiting all modified files for release");
      return execAsync("git add --all");
    })
    .then(() => execAsync(`git commit -m \"compiles v${version}\"`))
    .then(() => {
      log.timer("tagging latest commit");
      return execAsync(`git tag v${version}`);
    })
    .then(() => {
      log.timer("pushing to repository");
      return execAsync("git push origin --follow-tags");
    })
    .then(() => {
      log.timer("publishing release notes");
      github.authenticate({type: "oauth", token});
      return github.repos.createRelease({
        owner: "d3plus",
        repo: name,
        tag_name: `v${version}`,
        name: `v${version}`,
        body: commits,
        prerelease
      });
    })
    .then(() => {
      log.timer("attaching .zip distribution to release");
      return github.repos.getReleaseByTag({
        owner: "d3plus",
        repo: name,
        tag: `v${version}`
      });
    })
    .then(release => {
      releaseUrl = release.data.upload_url;
      zipSize = fs.statSync(`build/${name}.zip`).size;

      return github.repos.uploadAsset({
        url: releaseUrl,
        file: fs.createReadStream(`build/${name}.zip`),
        contentType: "application/zip",
        contentLength: zipSize,
        name: `${name}.zip`,
        label: `${name}.zip`,
        owner: "d3plus",
        repo: name
      });

    })
    .then(() => {
      log.exit();
      shell.exit(0);
    })
    .catch(err => {
      log.fail(err);
      log.exit();
      shell.exit(1);
    });

}
61132
function gitPush () {
      var branch = options.branch;
      var withForce = options.force ? ' --force ' : '';

      if (options.remoteBranch) branch += ':' + options.remoteBranch;

      log.subhead('Pushing ' + options.branch + ' to ' + options.remote + withForce);
      execWrap('git push ' + withForce + remoteName + ' ' + branch, false, true);

      if (options.tag) {
        execWrap('git push ' + remoteName + ' ' + options.tag);
      }
    }