Skip to content

Commit 6230d2d

Browse files
Nethanosrisantos
andcommitted
Add Release workflow
- Add `release-it@19.0.3` - Remove `.travis.yml` - Update minimum Node.js version to 20 - Update `@uphold/github-changelog-generator@4.0.2` - Update `README.md` with release process Co-authored-by: Adeildo Neto <adeildo.neto@uphold.com> Co-authored-by: Rafael Santos <rafael.santos@uphold.com>
1 parent 5f8774e commit 6230d2d

6 files changed

Lines changed: 1349 additions & 89 deletions

File tree

.github/workflows/release.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
VERSION_BUMP:
7+
description: 'The version bump'
8+
type: choice
9+
options:
10+
- major
11+
- minor
12+
- patch
13+
default: minor
14+
required: true
15+
16+
jobs:
17+
release:
18+
environment: release
19+
runs-on: ubuntu-latest
20+
concurrency:
21+
group: release-${{ github.repository }}-${{ github.ref_name }}
22+
cancel-in-progress: false
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
with:
28+
persist-credentials: false
29+
30+
- name: Setup Node.js version
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 22
34+
35+
- name: Install dependencies
36+
run: |
37+
npm install -g yarn@1
38+
yarn install --frozen-lockfile
39+
40+
- name: Configure git
41+
run: |
42+
git config user.name "Uphold"
43+
git config user.email "bot@uphold.com"
44+
git config --global url.https://${{ secrets.RELEASE_GITHUB_TOKEN }}@github.com/.insteadOf https://github.com/
45+
46+
- name: Configure npm
47+
run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.RELEASE_NPM_TOKEN }}
48+
49+
50+
- name: Generate release
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
53+
run: npm run release -- --increment "${{ github.event.inputs.VERSION_BUMP }}" -V

.release-it.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
git: {
3+
changelog: 'echo "## Changelog\\n\\n$(npx @uphold/github-changelog-generator -f unreleased | tail -n +4 -f)"',
4+
commitMessage: 'Release ${version}',
5+
requireBranch: 'master',
6+
requireCommits: true,
7+
tagName: 'v${version}'
8+
},
9+
github: {
10+
release: true,
11+
releaseName: 'v${version}'
12+
},
13+
hooks: {
14+
'after:bump': `
15+
echo "$(npx @uphold/github-changelog-generator -f v\${version})\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md &&
16+
git add CHANGELOG.md --all
17+
`
18+
},
19+
npm: {
20+
publish: true
21+
}
22+
};

.travis.yml

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

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ A full coverage report will be generated on *test/coverage* folder.
128128

129129
Please create a PR with a description of the changes, its motivation and impacted areas, making sure the build passes.
130130

131-
## Release
131+
## Release process
132132

133-
```sh
134-
$ yarn release [<version> | major | minor | patch]
135-
```
133+
The release of a version is automated via the [release](https://github.com/uphold/uphold-validator.js/.github/workflows/release.yml) GitHub workflow.
134+
Run it by clicking the "Run workflow" button.
136135

137136
## License
138137

package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"name": "@uphold/http-errors",
33
"version": "1.4.0",
4-
"description": "Set of errors based on http-standard-error",
4+
"description": "Set of errors based on standard-http-error",
55
"license": "MIT",
66
"author": "Uphold",
77
"main": "src/index.js",
8+
"files": [
9+
"src"
10+
],
811
"types": "types/index.d.ts",
912
"scripts": {
10-
"changelog": "github-changelog-generator --future-release=v$npm_package_version > CHANGELOG.md",
1113
"cover": "yarn test -- --coverage",
1214
"lint": "eslint --cache src test",
13-
"release": "npm version $1 -m 'Release %s'",
14-
"test": "jest --config jest.json",
15-
"version": "yarn changelog && git add CHANGELOG.md"
15+
"release": "release-it",
16+
"test": "jest --config jest.json"
1617
},
1718
"pre-commit": [
1819
"lint"
@@ -22,13 +23,14 @@
2223
"standard-http-error": "2.0.1"
2324
},
2425
"devDependencies": {
25-
"@uphold/github-changelog-generator": "^0.7.0",
26+
"@uphold/github-changelog-generator": "^4.0.2",
2627
"eslint": "^5.0.1",
2728
"eslint-config-uphold": "^0.1.1",
2829
"jest": "20.0.4",
29-
"pre-commit": "1.2.2"
30+
"pre-commit": "1.2.2",
31+
"release-it": "^19.0.3"
3032
},
3133
"engines": {
32-
"node": ">=4"
34+
"node": ">=20"
3335
}
3436
}

0 commit comments

Comments
 (0)