Skip to content

Commit 08421f3

Browse files
authored
Merge pull request #49 from LucianBuzzo/codex/configure-github-actions-for-versionist
Add versionist release workflow
2 parents 8caf2fb + 08b8c5c commit 08421f3

File tree

4 files changed

+71
-1
lines changed

4 files changed

+71
-1
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Versionist Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Use Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: 16
18+
- run: npm install
19+
- name: Run versionist
20+
run: npx versionist
21+
- name: Commit and tag release
22+
run: |
23+
git config user.name "github-actions[bot]"
24+
git config user.email "github-actions[bot]@users.noreply.github.com"
25+
git add CHANGELOG.md package.json
26+
if git diff --cached --quiet; then
27+
echo "No versionist changes to commit"
28+
exit 0
29+
fi
30+
VERSION=$(node -p "require('./package.json').version")
31+
git commit -m "chore(release): v$VERSION"
32+
git tag -a "v$VERSION" -m "v$VERSION"
33+
git push --follow-tags

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,17 @@ The icon at the top of this file is provided by
109109
[svgrepo.com](https://www.svgrepo.com/svg/293783/architecture-blueprint) and is
110110
licensed under [Creative Commons BY
111111
4.0](https://creativecommons.org/licenses/by/4.0/).
112+
113+
## Contributing
114+
115+
This project uses [Versionist](https://github.com/balena-io/versionist) to maintain the changelog and version numbers. Each commit must include a footer specifying the semantic version change and a changelog entry:
116+
117+
```
118+
docs: improve README
119+
120+
Change-Type: patch
121+
Changelog-Entry: Improve README documentation
122+
Signed-off-by: Your Name <you@example.com>
123+
```
124+
125+
The `Change-Type` can be `major`, `minor` or `patch`. `Changelog-Entry` is a short description of the change. Releases are automatically created when changes land on the `master` branch.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"stryker": "^0.33.1",
4242
"stryker-api": "^0.22.0",
4343
"stryker-html-reporter": "^0.16.9",
44-
"stryker-javascript-mutator": "^0.12.1"
44+
"stryker-javascript-mutator": "^0.12.1",
45+
"versionist": "^8.0.0"
4546
},
4647
"ava": {
4748
"files": [

versionist.conf.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
3+
module.exports = {
4+
subjectParser: 'angular',
5+
updateVersion: 'package.json',
6+
addEntryToChangelog: 'prepend',
7+
includeCommitWhen: commit => commit.footer['Changelog-Entry'],
8+
getIncrementLevelFromCommit: commit => commit.footer['Change-Type'],
9+
changelogFile: 'CHANGELOG.md',
10+
template: [
11+
'## v{{version}} - {{date}}',
12+
'',
13+
'{{#each commits}}',
14+
'{{#with footer}}',
15+
'* {{capitalize Changelog-Entry}}',
16+
'{{/with}}',
17+
'{{/each}}',
18+
''
19+
].join('\n'),
20+
header:
21+
'# Change Log\n\nAll notable changes to this project will be documented in this file automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!\nThis project adheres to [Semantic Versioning](http://semver.org/).\n\n'
22+
}

0 commit comments

Comments
 (0)