Skip to content

Commit 7f27da1

Browse files
committed
Add changelog and release generation
Signed-off-by: Javier Romero <[email protected]>
1 parent 3e53856 commit 7f27da1

File tree

5 files changed

+52
-15
lines changed

5 files changed

+52
-15
lines changed

.circleci/config.yml

+40-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ orbs:
33
orb-tools: circleci/[email protected]
44

55
workflows:
6-
validate-publish-dev:
6+
validate-dev:
77
jobs:
88
- orb-tools/lint
99
- orb-tools/publish-dev:
@@ -13,15 +13,21 @@ workflows:
1313
checkout: true
1414
requires:
1515
- orb-tools/lint
16-
tag-triggered-publish:
16+
draft-release:
1717
jobs:
1818
- hold-for-approval:
1919
filters:
2020
branches:
21-
ignore: /.*/
22-
tags:
23-
only: /^\d+\.\d+\.\d+$/
21+
only: /release\/.*/
2422
type: approval
23+
- github-release:
24+
filters:
25+
branches:
26+
only: /release\/.*/
27+
requires:
28+
- hold-for-approval
29+
publish:
30+
jobs:
2531
- orb-tools/publish:
2632
orb-ref: buildpacks/pack@$CIRCLE_TAG
2733
orb-path: orb.yml
@@ -31,6 +37,33 @@ workflows:
3137
ignore: /.*/
3238
tags:
3339
only: /^\d+\.\d+\.\d+$/
34-
requires:
35-
- hold-for-approval
3640

41+
jobs:
42+
github-release:
43+
machine:
44+
image: ubuntu-2004:202010-01
45+
steps:
46+
- run:
47+
name: Install generator
48+
command: gem install github_changelog_generator
49+
- run:
50+
name: Install releaser
51+
command: go get -u github.com/tcnksm/ghr
52+
- checkout
53+
- run:
54+
name: Determine version
55+
command: |
56+
[[ $CIRCLE_BRANCH =~ ^release/(.*)$ ]] && echo -n ${BASH_REMATCH[1]} > VERSION || (echo "failed to determine version" && exit 99)
57+
cat VERSION
58+
- run:
59+
name: Generate changelog
60+
command: |
61+
github_changelog_generator --user $CIRCLE_PROJECT_USERNAME --project $CIRCLE_PROJECT_REPONAME --token $GITHUB_BOT_PAT --future-release $(cat VERSION) -o CHANGELOG.tmp.md
62+
# remove footer
63+
head -n -3 CHANGELOG.tmp.md > CHANGELOG.md
64+
cat CHANGELOG.md
65+
- run:
66+
name: Create GH release
67+
command: |
68+
VERSION=$(cat VERSION)
69+
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

.github_changelog_generator

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
unreleased-only=true
2+
issues=false
3+
bugs-label=Fixes:
4+
bug-labels=type/bug
5+
header-label=## Changelog
6+
usernames-as-github-logins=true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md

README.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ See the [documentation on the CircleCI Orb Registry](https://circleci.com/orbs/r
1212

1313
## Releasing
1414

15-
Create a tag a push it:
16-
17-
```
18-
$ git tag x.y.z
19-
$ git push --tags
20-
```
21-
22-
Check [CircleCI](https://circleci.com/gh/buildpacks/pack-orb) to manually approve the release workflow.
15+
1. Create a `release/<#.#.#>` branch
16+
- `<#.#.#>` will be the version released
17+
2. Check [CircleCI](https://circleci.com/gh/buildpacks/pack-orb) to manually approve the release workflow.
18+
3. Check [releases](https://github.com/buildpacks/pack-orb/releases) and publish release draft.

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2.2

0 commit comments

Comments
 (0)