From 4f0a099152fc6a2ead15a0850229a3458e324ad4 Mon Sep 17 00:00:00 2001 From: Alexey Rogachevskiy Date: Thu, 13 Aug 2020 22:53:44 +0300 Subject: [PATCH] travis: Remove changelog generation --- .travis.yml | 9 ------ gen_changelog.py | 83 ------------------------------------------------ 2 files changed, 92 deletions(-) delete mode 100644 gen_changelog.py diff --git a/.travis.yml b/.travis.yml index 6094f267..5ba46df9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,14 +100,6 @@ jobs: verbose: true on: branch: master - - stage: Annotate - name: Auto-generate changelog - language: python - python: 3.6 - install: - - pip install GitPython PyGithub - script: - - PYTHONUNBUFFERED=1 python ./gen_changelog.py - stage: Build name: Editorconfig-lint language: generic @@ -118,7 +110,6 @@ jobs: - ./ec-linux-amd64 -spaces-after-tabs -e "roslib.js|ros3d.js|eventemitter2.js|draw.cpp|BinUtils.swift|\.idea|apps/android/app|Assets.xcassets|test_parser_pass.txt|test_node_failure.txt|aruco_pose/vendor|\.stl|\.dxf|\.dae" stages: - Build - - Annotate # More info there # https://github.com/travis-ci/travis-ci/issues/6893 # https://docs.travis-ci.com/user/customizing-the-build/ diff --git a/gen_changelog.py b/gen_changelog.py deleted file mode 100644 index 6f332f39..00000000 --- a/gen_changelog.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 - -# Generate and upload changelog - -from git import Repo, exc -from github import Github -import os -import sys - -upload_changelog = True - -try: - current_tag = os.environ['TRAVIS_TAG'] - if current_tag == '': - current_tag = 'HEAD' - upload_changelog = False - print('TRAVIS_TAG is set to {}'.format(current_tag)) -except KeyError: - print('TRAVIS_TAG not set - not uploading changelog') - current_tag = 'HEAD' - upload_changelog = False - -try: - api_key = os.environ['GITHUB_OAUTH_TOKEN'] -except KeyError: - print('GITHUB_OAUTH_TOKEN not set - not uploading changelog') - api_key = None - upload_changelog = False - -try: - repo_slug = os.environ['TRAVIS_REPO_SLUG'] -except KeyError: - print('TRAVIS_REPO_SLUG not set - cannot determine remote repository') - repo_slug = '' - if upload_changelog: - exit(1) - -if len(sys.argv) > 1: - repo_path = sys.argv[1] -else: - repo_path = '.' - -print('Opening repository at {}'.format(repo_path)) -repo = Repo(repo_path) -git = repo.git() -try: - print('Unshallowing repository') - git.fetch('--unshallow', '--tags') -except exc.GitCommandError: - print('Repository already unshallowed') -print('Attempting to get previous tag') -try: - base_tag = git.describe('--tags', '--abbrev=0', '{}^'.format(current_tag)) -except exc.GitCommandError: - print('No tags found') - base_tag = 'empty' -print('Base tag set to {}'.format(base_tag)) - -if base_tag == 'empty': - changelog_link = 'https://github.com/{}/commits'.format(repo_slug) -else: - changelog_link = 'https://github.com/{}/compare/{}...{}'.format(repo_slug, base_tag, current_tag) -print('Current changelog: \n{}'.format(changelog_link)) - -# Only interact with Github if uploading is enabled -if upload_changelog: - gh = Github(api_key) - gh_repo = gh.get_repo(repo_slug) - # Get all releases and find ours by its tag name - gh_release = None - for release in gh_repo.get_releases(): - if release.tag_name == current_tag: - gh_release = release - if gh_release is None: - # We could not find the correct release, so here's our last resort. It will most likely fail. - gh_release = gh_repo.get_release(current_tag) - gh_body = gh_release.body - if gh_body is None: - gh_body = '' - gh_body = '{}\nChanges between `{}` and `{}`: {}.'.format(gh_body, base_tag, current_tag, changelog_link) - print('New release body: {}'.format(gh_body)) - gh_release.update_release(gh_release.tag_name, gh_body, draft=True, prerelease=True, - tag_name=gh_release.tag_name, target_commitish=gh_release.target_commitish)