Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
],
"subject-case": [2, "never", ["start-case", "pascal-case", "upper-case"]],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"header-max-length": [2, "always", 72],
"body-max-line-length": [2, "always", 500]
}
}
25 changes: 25 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Commit Lint

on:
pull_request:
branches: [main, dev]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install dependencies
run: npm ci

- name: Validate PR commits with commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
64 changes: 64 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Semantic Release

on:
push:
branches:
- main
- dev

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .

- name: Run tests
run: |
python -c "import hatch_validator; print('Package imports successfully')"

release:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Generate GitHub App Token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.SEMANTIC_RELEASE_APP_ID }}
private_key: ${{ secrets.SEMANTIC_RELEASE_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install Node dependencies
run: npm ci

- name: Verify npm audit
run: npm audit signatures

- name: Release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: npx semantic-release
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,12 @@ cython_debug/

# PyPI configuration file
.pypirc

# Node.js dependencies for semantic-release
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Semantic-release
.semantic-release/
62 changes: 62 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"repositoryUrl": "https://github.com/CrackingShells/Hatch-Validator",
"tagFormat": "v${version}",
"branches": [
"main",
{
"name": "dev",
"prerelease": "dev"
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{"type": "docs", "scope": "README", "release": "patch"},
{"type": "refactor", "release": "patch"},
{"type": "style", "release": "patch"},
{"type": "test", "release": false},
{"type": "chore", "release": false}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "docs", "section": "Documentation"},
{"type": "refactor", "section": "Code Refactoring"},
{"type": "perf", "section": "Performance Improvements"}
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md", "pyproject.toml"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"successComment": false,
"failComment": false,
"releasedLabels": false
}
]
]
}
Loading