automate-release 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -216
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,253 +1,76 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<br>
|
|
2
|
+
<img width="150" src="https://github.com/Kikobeats/automate-release/raw/master/media/logo.png" alt="automate-release">
|
|
3
|
+
<br>
|
|
5
4
|
<br>
|
|
6
5
|
</div>
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
A release might seem just an irrelevant number, but here you'll find why you should be using it.
|
|
11
|
-
|
|
12
|
-
Release software is part of our developer day, but we tend to run it manually just we remember it, being a source of errors.
|
|
13
|
-
|
|
14
|
-
Nowadays, we have the best tools to automate this task so let's use them.
|
|
15
|
-
|
|
16
|
-
Your next release will be automatically doing:
|
|
17
|
-
|
|
18
|
-
- [Follow a Git Commit Convention](#follow-a-git-commit-convention)
|
|
19
|
-
* [Commit Message Guidelines](#commit-message-guidelines)
|
|
20
|
-
* [Examples of Git Commits](#examples-of-git-commits)
|
|
21
|
-
- [Determinate Next Version Based on History](#determinate-next-version-based-on-history)
|
|
22
|
-
* [GitHub Release](#github-release)
|
|
23
|
-
- [Continous Release](#continous-release)
|
|
24
|
-
* [Release on CI/CD](#release-on-cicd)
|
|
25
|
-
- [Communicate Your Changes](#communicate-your-changes)
|
|
26
|
-
* [Be Notified](#be-notified)
|
|
27
|
-
* [Publishing the Latest Release](#publishing-the-latest-release)
|
|
28
|
-
|
|
29
|
-
Let me show you how to do it.
|
|
30
|
-
|
|
31
|
-
## Follow a Git Commit Convention
|
|
32
|
-
|
|
33
|
-
> **Tip**: You can use a different [convention configuration](https://github.com/marionebl/commitlint#shared-configuration).
|
|
34
|
-
|
|
35
|
-
Using a `git commit` convention for our git messages help us all the messages of the contributors have a homogeneous appearance.
|
|
36
|
-
|
|
37
|
-
In addition, because we are going to use the same pattern for all the git messages, we can use that for do extra things, like for example, classify commits correctly at `CHANGELOG.md` or determinate what is the next version to release based on commit history.
|
|
38
|
-
|
|
39
|
-
For ensuring all git messages follow the same pattern, We are going to use [commitlint](https://github.com/marionebl/commitlint) for linting git messages.
|
|
40
|
-
|
|
41
|
-

|
|
42
|
-
|
|
43
|
-
You can't do the commit until the format is valid: It'll force you to follow a strict format into your git messages.
|
|
44
|
-
|
|
45
|
-
<small>(Actually, you could bypass this step using the `--no-verify` option, but avoid do that).</small>
|
|
46
|
-
|
|
47
|
-
That's also a thing applicable to Pull Request title:
|
|
48
|
-
|
|
49
|
-

|
|
50
|
-
|
|
51
|
-
In that case, integrate [commitlintbot](https://github.com/paulirish/commitlintbot) with your git project to have the same effect.
|
|
52
|
-
|
|
53
|
-
### Commit Message Guidelines
|
|
54
|
-
|
|
55
|
-
> **Tip**: Read more on [Angular contribution guideline](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type).
|
|
56
|
-
|
|
57
|
-
The git message must have a **type**. It could be:
|
|
58
|
-
|
|
59
|
-
* **build**: Changes that affect the build system or external dependencies.
|
|
60
|
-
* **ci**: Changes to our CI configuration files and scripts.
|
|
61
|
-
* **docs**: Documentation only changes.
|
|
62
|
-
* **feat**: A new feature.
|
|
63
|
-
* **fix**: A bug fix.
|
|
64
|
-
* **perf**: A code change that improves performance.
|
|
65
|
-
* **refactor**: A code change that neither fixes a bug or adds a feature.
|
|
66
|
-
* **style**: Changes that do not affect the meaning of the code.
|
|
67
|
-
* **test**: Adding missing tests or correcting existing tests.
|
|
68
|
-
|
|
69
|
-
I know. really, I know.
|
|
70
|
-
|
|
71
|
-
The first time you use a convention for commits, you might think that it's **over-engineering**.
|
|
72
|
-
|
|
73
|
-
But, after use it a bit, it's **very helpful**, It makes easy read all the commits quickly or just focus in a determinate type of commits.
|
|
74
|
-
|
|
75
|
-
### Examples of Git Commits
|
|
76
|
-
|
|
77
|
-
All the following examples are usual and valid:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
build: update dependencies
|
|
81
|
-
ci: setup travis credentials
|
|
82
|
-
refactor: move scripts
|
|
83
|
-
fix: use user agent provided by parameters
|
|
84
|
-
test: update snapshots
|
|
85
|
-
style: use space instead of tabs
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Determinate Next Version Based on History
|
|
89
|
-
|
|
90
|
-
Now that we have a `git commit` convention, we can jump in the next thing, that will make our first release 🎉.
|
|
91
|
-
|
|
92
|
-
For do that, we are going to use [standard-version](https://github.com/conventional-changelog/standard-version). After reading your git history and it will determinate what is the next release version.
|
|
93
|
-
|
|
94
|
-

|
|
95
|
-
|
|
96
|
-
[standard-version](https://github.com/conventional-changelog/standard-version) will determinate automagically the next version to release based on your `git history`.
|
|
97
|
-
|
|
98
|
-
For do that it will consider:
|
|
99
|
-
|
|
100
|
-
**patches** (`1.0.0` → `1.0.1`)
|
|
7
|
+
**automate-release** configures your project so that every commit pushed to the main branch triggers a new release automatically. No human factor is involved.
|
|
101
8
|
|
|
102
|
-
|
|
103
|
-
git commit -a -m "fix(parsing): fixed a bug in our parser"
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**features** (`1.0.0` → `1.1.0`)
|
|
9
|
+
When you create a new project, the first thing you should do is:
|
|
107
10
|
|
|
108
11
|
```bash
|
|
109
|
-
|
|
12
|
+
npx automate-release
|
|
110
13
|
```
|
|
111
14
|
|
|
112
|
-
|
|
15
|
+
If you use [direnv](https://direnv.net/) with a `.envrc` file, you can also sync your local tokens to GitHub Secrets automatically:
|
|
113
16
|
|
|
114
17
|
```bash
|
|
115
|
-
|
|
116
|
-
BREAKING CHANGE: new library does not support foo-construct"
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
A release has some tasks associated:
|
|
120
|
-
|
|
121
|
-
- 👉 Increment the version at `package.json`.
|
|
122
|
-
- 👉 Generate a new entry in your `CHANGELOG.md`
|
|
123
|
-
- 👉 Create a new specific git commit for the released version.
|
|
124
|
-
- 👉 Create a new `git tag` with the version associated.
|
|
125
|
-
|
|
126
|
-
In addition, GitHub usernames (`@kikobeats`) and issue references (`#133`) will be swapped out for the
|
|
127
|
-
appropriate URLs in your `CHANGELOG.md`.
|
|
128
|
-
|
|
129
|
-
A good practice is to put the command as `npm run release` script for performing the action.
|
|
130
|
-
|
|
131
|
-
```json
|
|
132
|
-
{
|
|
133
|
-
"scripts": {
|
|
134
|
-
"release": "standard-version",
|
|
135
|
-
"release:tags": "git push --follow-tags origin master",
|
|
136
|
-
"postrelease": "npm run release:tags"
|
|
137
|
-
}
|
|
138
|
-
}
|
|
18
|
+
GH_TOKEN=xxx npx automate-release --tokens
|
|
139
19
|
```
|
|
140
20
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
So, next time you want to do a release, just type `npm run release` (make sense, uh).
|
|
21
|
+
This single command bootstraps your repository with the best practices for software releasing:
|
|
144
22
|
|
|
145
|
-
|
|
23
|
+
https://github.com/user-attachments/assets/be26eb77-2ffd-46d1-9414-3ed063ece8fc
|
|
146
24
|
|
|
147
|
-
|
|
25
|
+
Releasing software is a fundamental part of our developer life, but we often do it manually, which is a source of errors and takes time away from what we love: coding.
|
|
148
26
|
|
|
149
|
-
|
|
27
|
+
`automate-release` brings you:
|
|
150
28
|
|
|
151
|
-
|
|
29
|
+
- [Follow a git commit convention](#follow-a-git-commit-convention)
|
|
30
|
+
- [History-driven releases](#history-driven-releases)
|
|
31
|
+
- [Seamless GitHub integration](#seamless-github-integration)
|
|
152
32
|
|
|
33
|
+
## Follow a git commit convention
|
|
153
34
|
|
|
154
|
-
|
|
35
|
+
Using a convention for git messages ensures that all contributors produce a homogeneous history. But it's not just about aesthetics; it's about **programmable history**.
|
|
155
36
|
|
|
156
|
-
 has a special place into the repository for reflecting releases:
|
|
161
|
-
|
|
162
|
-

|
|
163
|
-
|
|
164
|
-
When you push a `git tag`, it will appear here, but nothing more. No text or changes associated.
|
|
165
|
-
|
|
166
|
-
Now that we are generating a `CHANGELOG.md` it would be interesting to reflect the changes associated with each version.
|
|
167
|
-
|
|
168
|
-
We can use a tool called [releaser-tools](https://github.com/conventional-changelog/releaser-tools) who will do exactly that, leaving our release section pretty 💅.
|
|
169
|
-
|
|
170
|
-
> **Note**: Remember to setup [`CONVENTIONAL_GITHUB_RELEASER_TOKEN`](https://github.com/conventional-changelog/releaser-tools/tree/master/packages/conventional-github-releaser#setup-token-for-cli). You can use [direnv](https://direnv.net/) for declaring local development variables.
|
|
171
|
-
|
|
172
|
-
We need to associate it as part of our `postrelease` script:
|
|
173
|
-
|
|
174
|
-
```json
|
|
175
|
-
{
|
|
176
|
-
"scripts": {
|
|
177
|
-
"postrelease": "npm run release:tags && npm run release:github",
|
|
178
|
-
"release": "standard-version",
|
|
179
|
-
"release:github": "github-generate-release",
|
|
180
|
-
"release:tags": "git push --follow-tags origin master"
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
```
|
|
37
|
+

|
|
184
38
|
|
|
185
|
-
|
|
39
|
+
By following a pattern, we can automatically classify commits in a `CHANGELOG.md` and determine the next version to release (patch, feature, or breaking change).
|
|
186
40
|
|
|
187
|
-

|
|
188
42
|
|
|
189
|
-
|
|
43
|
+
`automate-release` sets up [commitlint](https://github.com/marionebl/commitlint) for that purpose:
|
|
190
44
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
The rest of the things should be work in a boring and automated way 🤖.
|
|
194
|
-
|
|
195
|
-

|
|
196
|
-
|
|
197
|
-
Every commit that land on the `master` branch will mean that a new version of your software could be released.
|
|
198
|
-
|
|
199
|
-
For projects with a lot of activity, the condition could be a little bit more relaxed; In that case, check [release-please](https://github.com/googleapis/release-please), where you have more control about when the next release will be shipped.
|
|
200
|
-
|
|
201
|
-
### Release on CI/CD
|
|
202
|
-
|
|
203
|
-
The right place to do this is as part of our **Continuous Integration**.
|
|
204
|
-
|
|
205
|
-

|
|
206
|
-
|
|
207
|
-
Every time a new Pull Request is merged in our `master` branch, our **Tests** will be executed to determinate if all is fine (nothing new here).
|
|
208
|
-
|
|
209
|
-
But now, after that, The **Release** stage will be executed, that will perform our `npm run release` command to complete the action.
|
|
210
|
-
|
|
211
|
-
<div align="center">
|
|
212
|
-
<img src="https://i.imgur.com/7x6doze.jpg">
|
|
213
|
-
<div><smal>Have you noticed that? It's the sweet sensation of automation.</small></div>
|
|
214
|
-
<br>
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
That's specially helpful as maintainer if you are already have automated part of the process that uses services such as [Greenkeeper](https://greenkeeper.io) to keep your dependencies up to date, that create PR very often if you have many dependencies or they are updated very often (something that happens all the time at NPM ecosystem).
|
|
218
|
-
|
|
219
|
-
You can see [.travis.yml](/.travis.yml) to see how it is done or just run `npx automate-release` to install it in your project folder.
|
|
220
|
-
|
|
221
|
-
## Communicate Your Changes
|
|
222
|
-
|
|
223
|
-
Releases also is a way to establish a compromise with your audience in order to know what's news.
|
|
45
|
+

|
|
224
46
|
|
|
225
|
-
|
|
47
|
+
You won't be able to commit unless the format is valid. It follows the [conventional commits specification](https://conventional-commits.vercel.app/), which quickly becomes the backbone of your automation.
|
|
226
48
|
|
|
227
|
-
|
|
49
|
+
## History-driven releases
|
|
228
50
|
|
|
229
|
-
|
|
51
|
+
As every commit pushed to the main branch will trigger a release, the next version is automatically determined based on your git history following [semver](https://semver.org/) rules:
|
|
230
52
|
|
|
231
|
-
|
|
53
|
+
- **patch** (`1.0.0` → `1.0.1`): When you commit a `fix`.
|
|
54
|
+
- **minor** (`1.0.0` → `1.1.0`): When you commit a `feat`.
|
|
55
|
+
- **major** (`1.0.0` → `2.0.0`): When you commit a `BREAKING CHANGE`.
|
|
232
56
|
|
|
233
|
-

|
|
234
58
|
|
|
235
|
-
|
|
59
|
+
This automated process handles the tedious work of incrementing the version in `package.json`, generating the `CHANGELOG.md` entry, and creating the release commit and tag.
|
|
236
60
|
|
|
237
|
-
|
|
61
|
+
## Seamless GitHub integration
|
|
238
62
|
|
|
239
|
-
|
|
240
|
-
- [GitHub RSS Feed](https://github.com/Kikobeats/automate-release/releases.atom) – For getting atom feed per `owner_name/repo_name`.
|
|
63
|
+
The human factor in a release should be limited to being the trigger: just push your code. Everything else should be automated.
|
|
241
64
|
|
|
242
|
-
|
|
65
|
+
`automate-release` deploys **GitHub Actions** that handle the entire workflow automatically:
|
|
243
66
|
|
|
244
|
-
|
|
67
|
+
- **Reliability**: Tests are executed on every push to ensure stability before any release.
|
|
68
|
+
- **Automation**: Contributors list is automatically updated and pushed back to the repository.
|
|
69
|
+
- **Transparency**: Your `CHANGELOG.md` is synchronized with your **GitHub Releases**.
|
|
70
|
+
- **Distribution**: The package is automatically published to the **NPM registry** once the release is tagged.
|
|
245
71
|
|
|
246
|
-
|
|
247
|
-
- [CodeRelease.io](https://coderelease.io) - GitHub Release Notifications on Your E-mail.
|
|
248
|
-
- [IFTTT](https://ifttt.com) / [Zapier](https://zapier.com/) – For declaring using *RSS-to-Slack* recipes or similar.
|
|
249
|
-
- [@github_releases_notify_bot](https://telegram.me/github_releases_notify_bot) – Telegram bot to receive release notifications.
|
|
72
|
+

|
|
250
73
|
|
|
251
|
-
|
|
74
|
+
A release is a commitment to your audience. `automate-release` ensures your users stay informed by reflecting your changes directly into the GitHub Release section, making your project look professional and transparent.
|
|
252
75
|
|
|
253
|
-
|
|
76
|
+

|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "automate-release",
|
|
3
3
|
"description": "No more manual work in your software releases.",
|
|
4
4
|
"homepage": "https://github.com/kikobeats/automate-release",
|
|
5
|
-
"version": "2.1.
|
|
5
|
+
"version": "2.1.2",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"automate-release": "bin/index.js"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"json-future": "~2.2.4",
|
|
45
45
|
"lodash": "~4.17.19",
|
|
46
46
|
"meow": "~9.0.0",
|
|
47
|
-
"nanospinner": "~1.
|
|
47
|
+
"nanospinner": "~1.2.2",
|
|
48
48
|
"picocolors": "~1.1.0",
|
|
49
49
|
"terminal-link": "~2.1.1",
|
|
50
50
|
"tinyspawn": "~1.5.5",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
|
|
77
77
|
"pretest": "npm run lint",
|
|
78
78
|
"release": "pnpm run release:version && pnpm run release:changelog && pnpm run release:commit && pnpm run release:tag",
|
|
79
|
-
"release:changelog": "conventional-changelog -i CHANGELOG.md",
|
|
79
|
+
"release:changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -s",
|
|
80
80
|
"release:commit": "git add package.json CHANGELOG.md && git commit -m \"chore(release): $(node -p \"require('./package.json').version\")\"",
|
|
81
81
|
"release:github": "github-generate-release",
|
|
82
82
|
"release:tag": "git tag -a v$(node -p \"require('./package.json').version\") -m \"v$(node -p \"require('./package.json').version\")\"",
|