Skip to content

Commit b71b748

Browse files
Nethanosrisantos
authored andcommitted
Add Release workflow
- Add `[email protected]` - Remove `.travis.yml` - Update minimum Node.js version to 20 - Update `@uphold/[email protected]` - Update `README.md` with release process, and fixing the Tests badge's URL. Co-authored-by: Adeildo Neto <[email protected]> Co-authored-by: Rafael Santos <[email protected]>
1 parent 5420d99 commit b71b748

File tree

5 files changed

+1282
-100
lines changed

5 files changed

+1282
-100
lines changed

.github/workflows/release.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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: yarn install --frozen-lockfile
37+
38+
- name: Configure git
39+
run: |
40+
git config user.name "Uphold"
41+
git config user.email "[email protected]"
42+
git config --global url.https://${{ secrets.RELEASE_GITHUB_TOKEN }}@github.com/.insteadOf https://github.com/
43+
44+
- name: Configure npm
45+
run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.RELEASE_NPM_TOKEN }}
46+
47+
- name: Generate release
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
50+
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+
};

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,16 @@ A full coverage report will be generated on `/coverage` folder.
139139

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

142-
## Release
142+
## Release process
143143

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

148147
## License
149148

150149
MIT
151150

152151
[npm-image]: https://img.shields.io/npm/v/@uphold/http-errors.svg
153152
[npm-url]: https://www.npmjs.com/package/@uphold/http-errors
154-
[tests-image]: https://github.com/uphold/uphold-http-errors/actions/workflows/tests.yaml/badge.svg?branch=master
155-
[tests-url]: https://github.com/uphold/uphold-http-errors/actions/workflows/tests.yaml
153+
[tests-image]: https://github.com/uphold/http-errors/actions/workflows/tests.yaml/badge.svg?branch=master
154+
[tests-url]: https://github.com/uphold/http-errors/actions/workflows/tests.yaml

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
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
"lint": "eslint",
12-
"release": "npm version $1 -m 'Release %s'",
14+
"release": "release-it",
1315
"test": "node --test test/**/*_test.js",
1416
"test:coverage": "NODE_V8_COVERAGE=coverage node --test --experimental-test-coverage test/**/*_test.js",
15-
"test:watch": "node --test --watch test/**/*_test.js",
16-
"version": "yarn changelog && git add CHANGELOG.md"
17+
"test:watch": "node --test --watch test/**/*_test.js"
1718
},
1819
"pre-commit": [
1920
"lint"
@@ -23,11 +24,12 @@
2324
"standard-http-error": "2.0.1"
2425
},
2526
"devDependencies": {
26-
"@uphold/github-changelog-generator": "^0.7.0",
27+
"@uphold/github-changelog-generator": "^4.0.2",
2728
"eslint": "^9.28.0",
2829
"eslint-config-uphold": "^6.5.1",
2930
"pre-commit": "1.2.2",
30-
"prettier": "^3.5.3"
31+
"prettier": "^3.5.3",
32+
"release-it": "^19.0.3"
3133
},
3234
"engines": {
3335
"node": ">=20"

0 commit comments

Comments
 (0)