Skip to content

Commit b4205a1

Browse files
feat: (DSO-2078) Implement conventional commits and task file (#27)
* feat: (DSO-2078) Implement conventional commits * feat: (DSO-2078) Fix tools versions file * chore: (DSO-2078) Update package json file * chore: (DSO-2078) Add husky files * chore: (DSO-2078) Fix package json version --------- Co-authored-by: Javier Carrillo <jamaca1410@gmail.com>
1 parent 35792b6 commit b4205a1

10 files changed

+6580
-0
lines changed

.github/workflows/commitlint.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: ✨ Lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: '${{ github.workflow }} @ ${{ github.ref }}'
10+
cancel-in-progress: true
11+
12+
jobs:
13+
commitlint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 💻 Checkout current code ref
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: 🟢 Configure Node.js on runner
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version-file: '.tool-versions'
25+
26+
- name: 📦 Install package dependencies using lockfile
27+
run: npm ci
28+
29+
# Check all commits pushed to this PR
30+
- name: 👁️‍🗨️ Validate PR commits with commitlint
31+
run: >-
32+
npx commitlint
33+
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }}
34+
--to ${{ github.event.pull_request.head.sha }}
35+
--verbose
36+
37+
- name: 🔎 Validate PR title with commitlint
38+
run: echo "${{ github.event.pull_request.title }}" | npx commitlint

.github/workflows/release.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 🚀 Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: 💻 Checkout current pull-request revision code
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: 💼 Configure Git user
16+
run: |
17+
git config user.name "gbh-devops-bot"
18+
git config user.email "devops@gbh.com.do"
19+
20+
- name: 📦 Install package dependencies using lockfile
21+
run: npm ci
22+
23+
- name: 🚀 Run new version for production
24+
run: npx release-it --ci
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.DEVOPS_USER_TOKEN }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit ${1}

.husky/pre-commit

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
5+
REGEX="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)-[A-Z]{2,4}-[0-9]{1,5}-[A-Za-z0-9-]+$"
6+
7+
if ! [[ $BRANCH =~ $REGEX ]]; then
8+
echo "Error: Your commit was rejected due to an invalid branch name.
9+
Branch names should follow the format:
10+
<type>-<project_id>-<issue_number>-<description>
11+
Where:
12+
- <type> is one of: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test
13+
- <project_id> is a capitalized two to four letter abbreviation of the project
14+
- <issue_number> is a numeric identifier of the issue being addressed
15+
- <description> is a brief description of the changes
16+
Example: feat-RI-123-add-new-feature"
17+
exit 1
18+
fi

.release-it.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"github": {
3+
"release": true,
4+
"releaseName": "v${version}"
5+
},
6+
"git": {
7+
"commitMessage": "chore: release v${version}",
8+
"requireBranch": "main",
9+
"tagMatch": "v[0-9]*\\.[0-9]*\\.[0-9]*",
10+
"tagName": "v${version}",
11+
"getLatestTagFromAllRefs": true,
12+
"tagExclude": "*[-]*",
13+
"push": true,
14+
"requireCommits": true,
15+
"release": true,
16+
"pushArgs": ["--no-verify", "--follow-tags"],
17+
"commitArgs": ["--no-verify"]
18+
},
19+
"plugins": {
20+
"@release-it/conventional-changelog": {
21+
"preset": {
22+
"name": "conventionalcommits",
23+
"preset": {
24+
"name": "conventionalcommits"
25+
}
26+
},
27+
"infile": "CHANGELOG.md"
28+
}
29+
}
30+
}

.tool-versions

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
task 3.35.1
2+
node 20.10.0

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

0 commit comments

Comments
 (0)