Skip to content

Commit 7397c6b

Browse files
authored
Create changelog orb (#1)
1 parent 0dc12b0 commit 7397c6b

File tree

4 files changed

+69
-103
lines changed

4 files changed

+69
-103
lines changed

.circleci/config.yml

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,13 @@ version: 2.1
22
description: Creates and updates the CHANGELOG.md file
33

44
orbs:
5-
changelog:
6-
executors:
7-
changelog:
8-
docker:
9-
-
10-
image: circleci/ruby:2.5-node
11-
jobs:
12-
changelog:
13-
parameters:
14-
gitemail:
15-
description: The git committer's email
16-
type: string
17-
18-
gitusername:
19-
description: The git committer's username
20-
type: string
21-
default: aeneasr
22-
gitauthtoken:
23-
description: The git committer's username
24-
type: string
25-
executor: changelog
26-
steps:
27-
- run: git config --global push.default matching
28-
- checkout
29-
- run: gem install github_changelog_generator -v 1.14.3
30-
- run: sudo npm i -g doctoc
31-
- restore_cache:
32-
keys:
33-
- changelog-v1
34-
- run: github_changelog_generator -u $CIRCLE_PROJECT_USERNAME -p $CIRCLE_PROJECT_REPONAME -o CHANGELOG.md --token <<parameters.gitauthtoken>> --cache-file /tmp/github_changelog_generator
35-
- save_cache:
36-
key: changelog-v1
37-
paths:
38-
- "/tmp/github_changelog_generator"
39-
- run: doctoc CHANGELOG.md
40-
- run: git config --global user.email "<<parameters.gitemail>>"
41-
- run: git config --global user.name "<<parameters.gitusername>>"
42-
- run: git add CHANGELOG.md
43-
- run: |
44-
git commit -m "Update CHANGELOG [ci skip]" -- CHANGELOG.md
45-
- run: git push origin
5+
orb-tools: circleci/[email protected]
466

477
workflows:
48-
changelog:
8+
btd:
499
jobs:
50-
- changelog/changelog:
51-
gitauthtoken: $GITHUB_TOKEN
10+
- orb-tools/publish:
11+
orb-path: src/changelog.yml
12+
orb-ref: ory/changelog@dev:${CIRCLE_BRANCH}
13+
publish-token-variable: "$CIRCLECI_DEV_API_TOKEN"
14+
validate: true

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3-
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
3+
**Table of Contents**
44

55
- [Change Log](#change-log)
66

77
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
88

99
# Change Log
1010

11+
This Change Log was automatically generated
1112

12-
13-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

changelog.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/changelog.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: 2.1
2+
description: Creates and updates the CHANGELOG.md file
3+
4+
orbs:
5+
changelog:
6+
executors:
7+
changelog:
8+
docker:
9+
-
10+
image: circleci/ruby:2.5-node
11+
jobs:
12+
generate:
13+
parameters:
14+
gitemail:
15+
description: The git committer's email
16+
type: string
17+
18+
gitusername:
19+
description: The git committer's username
20+
type: string
21+
default: aeneasr
22+
gitauthtoken:
23+
description: A GitHub API Token
24+
type: env_var_name
25+
default: GITHUB_TOKEN
26+
executor: changelog
27+
steps:
28+
- run: git config --global push.default matching
29+
- checkout
30+
- run: gem install github_changelog_generator -v 1.14.3
31+
- run: sudo npm i -g doctoc
32+
- restore_cache:
33+
keys:
34+
- changelog-v1
35+
- run: github_changelog_generator -u $CIRCLE_PROJECT_USERNAME -p $CIRCLE_PROJECT_REPONAME -o CHANGELOG.md --token ${<<parameters.gitauthtoken>>} --cache-file /tmp/github_changelog_generator
36+
- save_cache:
37+
key: changelog-v1
38+
paths:
39+
- "/tmp/github_changelog_generator"
40+
- run: doctoc CHANGELOG.md
41+
- run: "sed -i 's/\\*\\*Table of Contents.*/**Table of Contents**/' CHANGELOG.md"
42+
- run: "sed -i 's/\\*This Change Log was.*/This Change Log was automatically generated/' CHANGELOG.md"
43+
- run: git config --global user.email "<<parameters.gitemail>>"
44+
- run: git config --global user.name "<<parameters.gitusername>>"
45+
- run: git add CHANGELOG.md
46+
- run: |
47+
git commit -m "Update CHANGELOG [ci skip]" -- CHANGELOG.md || true
48+
- run: git push origin || true
49+
50+
examples:
51+
changelog:
52+
description: Generate and commit the changelog
53+
usage:
54+
version: 2.1
55+
orbs:
56+
57+
workflows:
58+
generate:
59+
jobs:
60+
- changelog/changelog

0 commit comments

Comments
 (0)