Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,39 @@ $ github-changelog-generator --help
To generate a changelog for your GitHub project, use the following command:

```sh
$ echo "$(github-changelog-generator --base-branch=<base> --future-release=<release_name> --future-release-tag=<release_tag_name> --owner=<repo_owner> --repo=<repo_name>)$(tail -n +1 <your_changelog_file>)" > <your_changelog_file>
$ echo "$(github-changelog-generator --base-branch=<base> --future-release=<release_name> --future-release-tag=<release_tag_name> --owner=<repo_owner> --repo=<repo_name>)\n$(tail -n +2 <your_changelog_file>)" > <your_changelog_file>
```

The `--base-branch` option allows you to filter the PRs by base branch. If omitted, it will default to branch master.

Example:

```sh
$ echo "$(github-changelog-generator --base-branch=production)$(tail -n +1 CHANGELOG.md)" > CHANGELOG.md
$ echo "$(github-changelog-generator --base-branch=production)\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md
```

The `--future-release` and `--future-release-tag` options are optional. If you just want to build a new changelog without a new release, you can skip those options, and `github-changelog-generator` will create a changelog for existing releases only. Also, if your future release tag name is the same as your future release version number, then you can skip `--future-release-tag`.

Example:

```sh
$ echo "$(github-changelog-generator --future-release=1.2.3 --future-release-tag=v1.2.3)$(tail -n +1 CHANGELOG.md)" > CHANGELOG.md
$ echo "$(github-changelog-generator --future-release=1.2.3 --future-release-tag=v1.2.3)\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md
```

The `--owner` and `--repo` options allow you to specify the owner and name of the GitHub repository, respectively. If omitted, they will default to the values found in the project's git config.

Example:

```sh
$ echo "$(github-changelog-generator --owner=uphold --repo=github-changelog-generator)$(tail -n +1 CHANGELOG.md)" > CHANGELOG.md
$ echo "$(github-changelog-generator --owner=uphold --repo=github-changelog-generator)\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md
```

The `--labels` option allows you to filter what pull requests are used by their labels. This is useful for repositories with more than one project, by labeling each pull request by what project they belong to, generating a changelog for each project becomes as simple as:

Example:

```sh
$ echo "$(github-changelog-generator --labels projectX,general)$(tail -n +1 CHANGELOG.md)" > CHANGELOG.md
$ echo "$(github-changelog-generator --labels projectX,general)\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md
```

The `--rebuild` option allows you to fetch the repository's full changelog history.
Expand Down
27 changes: 27 additions & 0 deletions bin/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env sh

release() {

# Bump version using `yarn`.
yarn version --no-git-tag-version --new-version ${1:-patch}

# Get the new version number.
local version=`grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[", ]//g'`

# Create deploy branch.
git checkout -b deploy/${version}

# Generate changelog.
echo "$(bin/github-changelog-generator.js -f ${version} -t v${version})\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md

# Add modified files.
git add .

# Commit release with new version.
git commit -m "Release ${version}"

# Tag commit with the new version.
git tag v$version
}

release $1
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
},
"repository": "uphold/github-changelog-generator",
"scripts": {
"changelog": "echo \"$(./bin/github-changelog-generator.js -f $npm_package_version -t v$npm_package_version)$(tail -n +1 CHANGELOG.md)\" > CHANGELOG.md",
"lint": "eslint --cache src test",
"release": "npm version -m 'Release %s'",
"test": "jest",
"version": "npm run changelog && git add -A CHANGELOG.md"
"release": "./bin/release.sh",
"test": "jest"
},
"dependencies": {
"@octokit/graphql": "^4.6.1",
Expand Down