Skip to content

Commit

Permalink
Add changelog and release generation
Browse files Browse the repository at this point in the history
Signed-off-by: Javier Romero <[email protected]>
  • Loading branch information
jromero committed Dec 18, 2020
1 parent 3e53856 commit 7f27da1
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 15 deletions.
47 changes: 40 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ orbs:
orb-tools: circleci/[email protected]

workflows:
validate-publish-dev:
validate-dev:
jobs:
- orb-tools/lint
- orb-tools/publish-dev:
Expand All @@ -13,15 +13,21 @@ workflows:
checkout: true
requires:
- orb-tools/lint
tag-triggered-publish:
draft-release:
jobs:
- hold-for-approval:
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
only: /release\/.*/
type: approval
- github-release:
filters:
branches:
only: /release\/.*/
requires:
- hold-for-approval
publish:
jobs:
- orb-tools/publish:
orb-ref: buildpacks/pack@$CIRCLE_TAG
orb-path: orb.yml
Expand All @@ -31,6 +37,33 @@ workflows:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
requires:
- hold-for-approval

jobs:
github-release:
machine:
image: ubuntu-2004:202010-01
steps:
- run:
name: Install generator
command: gem install github_changelog_generator
- run:
name: Install releaser
command: go get -u github.com/tcnksm/ghr
- checkout
- run:
name: Determine version
command: |
[[ $CIRCLE_BRANCH =~ ^release/(.*)$ ]] && echo -n ${BASH_REMATCH[1]} > VERSION || (echo "failed to determine version" && exit 99)
cat VERSION
- run:
name: Generate changelog
command: |
github_changelog_generator --user $CIRCLE_PROJECT_USERNAME --project $CIRCLE_PROJECT_REPONAME --token $GITHUB_BOT_PAT --future-release $(cat VERSION) -o CHANGELOG.tmp.md
# remove footer
head -n -3 CHANGELOG.tmp.md > CHANGELOG.md
cat CHANGELOG.md
- run:
name: Create GH release
command: |
VERSION=$(cat VERSION)
ghr -draft -t $GITHUB_BOT_PAT -c $CIRCLE_SHA1 -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -b "$(cat CHANGELOG.md)" -n "pack-orb ${VERSION}" $VERSION
6 changes: 6 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
unreleased-only=true
issues=false
bugs-label=Fixes:
bug-labels=type/bug
header-label=## Changelog
usernames-as-github-logins=true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ See the [documentation on the CircleCI Orb Registry](https://circleci.com/orbs/r

## Releasing

Create a tag a push it:

```
$ git tag x.y.z
$ git push --tags
```

Check [CircleCI](https://circleci.com/gh/buildpacks/pack-orb) to manually approve the release workflow.
1. Create a `release/<#.#.#>` branch
- `<#.#.#>` will be the version released
2. Check [CircleCI](https://circleci.com/gh/buildpacks/pack-orb) to manually approve the release workflow.
3. Check [releases](https://github.com/buildpacks/pack-orb/releases) and publish release draft.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.2

0 comments on commit 7f27da1

Please sign in to comment.