Skip to content

Instantly share code, notes, and snippets.

@webpapaya
Last active July 17, 2020 03:59
Show Gist options
  • Save webpapaya/65651d31f538dbe3f64a65e7b77de551 to your computer and use it in GitHub Desktop.
Save webpapaya/65651d31f538dbe3f64a65e7b77de551 to your computer and use it in GitHub Desktop.
Travis CHANGELOG.md generator
#!/bin/bash
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$CHANGELOG_BRANCH" ]; then
echo "This commit was made against the $TRAVIS_BRANCH and not $CHANGELOG_BRANCH! Changelog not updated!"
exit 0
fi
gem install rack -v 1.6.4
gem install github_changelog_generator
rev=$(git rev-parse --short HEAD)
CHANGELOG_EMAIL=${CHANGELOG_EMAIL:='[email protected]'}
git config user.name "Travis CI"
git config user.email $CHANGELOG_EMAIL
CHANGELOG_BRANCH=${CHANGELOG_BRANCH:='master'}
git remote add upstream "https://[email protected]/$TRAVIS_REPO_SLUG.git"
git fetch upstream
git checkout $CHANGELOG_BRANCH
github_changelog_generator
git add -A CHANGELOG.md
git commit -m "updated changelog at ${rev}"
git push upstream $CHANGELOG_BRANCH
language: node_js
node_js:
- '6.3'
cache:
directories:
- node_modules
after_success:
- curl https://gist.githubusercontent.com/webPapaya/65651d31f538dbe3f64a65e7b77de551/raw/deploy-changelog.sh > deploy-changelog.sh && chmod u+x deploy-changelog.sh && ./deploy-changelog.sh;
env:
global:
- CHANGELOG_BRANCH=master
- secure: <YOUR ENCRYPTED $GITHUB_TOKEN>
- secure: <YOUR ENCRYPTED $CHANGELOG_GITHUB_TOKEN>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment