Skip to content

Commit

Permalink
Merge pull request #189 from lotyp/2.x
Browse files Browse the repository at this point in the history
ci: automate changelog and release management
  • Loading branch information
roxblnfk authored Apr 4, 2024
2 parents b13a232 + 707ffc2 commit 62f4d52
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 69 deletions.
43 changes: 43 additions & 0 deletions .github/.commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// More info: https://github.com/wayofdev/npm-shareable-configs/blob/master/packages/commitlint-config/src/index.js
const automaticCommitPattern = /^chore\(release\):.*\[skip ci]/

export default {
extends: ['@commitlint/config-conventional'],
/*
This resolves a linting conflict between commitlint's body-max-line-length
due to @semantic-release/git putting release notes in the commit body
https://github.com/semantic-release/git/issues/331
*/
ignores: [(commitMessage) => automaticCommitPattern.test(commitMessage)],
rules: {
'body-leading-blank': [1, 'always'],
'body-max-line-length': [2, 'always', 100],
'footer-leading-blank': [1, 'always'],
'footer-max-line-length': [2, 'always', 100],
'header-max-length': [2, 'always', 100],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'feat',
'fix',
'perf',
'docs',
'style',
'deps',
'refactor',
'ci',
'test',
'revert',
'build',
'chore',
],
],
},
}
83 changes: 83 additions & 0 deletions .github/.release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "node",
"include-component-in-tag": false,
"packages": {
".": {
"package-name": "database",
"changelog-path": "/CHANGELOG.md"
}
},
"changelog-sections": [
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "perf",
"section": "Performance Improvements",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "style",
"section": "Styles",
"hidden": false
},
{
"type": "deps",
"section": "Dependencies",
"hidden": false
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": false
},
{
"type": "test",
"section": "Tests",
"hidden": false
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous",
"hidden": true
},
{
"type": "revert",
"section": "Reverts",
"hidden": true
},
{
"type": "build",
"section": "Build System",
"hidden": true
},
{
"type": "security",
"section": "Security",
"hidden": true
},
{
"type": "translation",
"section": "Translations",
"hidden": true
}
]
}
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "2.9.0"
}
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

on: # yamllint disable-line rule:truthy
pull_request:
branches:
- 2.x

name: 🔍 Integration

jobs:
lint-commits:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: 📦 Check out the codebase
uses: actions/[email protected]

# See: https://github.com/wagoid/commitlint-github-action
- name: 🧐 Lint commits using "commitlint"
uses: wagoid/[email protected]
with:
configFile: ${{ github.workspace }}/.github/commitlint.config.mjs
failOnWarnings: false
failOnErrors: true
helpURL: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
26 changes: 26 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---

# https://github.com/wayofdev/gh-actions/blob/master/.github/workflows/create-release.yml
# https://github.com/google-github-actions/release-please-action#release-types-supported

on: # yamllint disable-line rule:truthy
push:
branches:
- 2.x

name: 📦 Create release

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: 🎉 Create release
uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: .github/.release-please-config.json
manifest-file: .github/.release-please-manifest.json
target-branch: 2.x

...
Loading

0 comments on commit 62f4d52

Please sign in to comment.