Skip to content

Commit

Permalink
chore: use conventional commits, introduce release please for automat…
Browse files Browse the repository at this point in the history
…ed release management (#64)
  • Loading branch information
ben-challis authored May 8, 2024
1 parent afb9efc commit ea9ff1f
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 1 deletion.
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 @@
{
".": "1.0.1"
}
21 changes: 21 additions & 0 deletions .github/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Source: @commitlint/config-conventional
module.exports = {
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-empty': [2, 'never'],
'subject-case': [2, 'never', ['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',
['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']
]
}
};
33 changes: 33 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"changelog-sections":
[
{ "type": "feat", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "perf", "section": "Performance Improvements" },
{ "type": "revert", "section": "Reverts" },
{ "type": "docs", "section": "Documentation", "hidden": true },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
],
"plugins": [
{
"type": "sentence-case"
}
],
"initial-version": "1.0.1",
"include-v-in-tag": false,
"include-component-in-tag": false,
"draft-pull-request": true,
"release-type": "php",
"pull-request-title-pattern": "chore: release ${version}",
"pull-request-header": "New release",
"pull-request-footer": "",
"packages": {
".": {}
}
}
3 changes: 2 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>Lendable/renovate-config"
"local>Lendable/renovate-config",
":semanticCommits"
]
}
28 changes: 28 additions & 0 deletions .github/workflows/conventional-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Conventional Commits

on:
# https://github.com/marketplace/actions/semantic-pull-request#event-triggers
pull_request:
types:
- opened
- edited
- reopened
- synchronize
merge_group:

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-22.04
steps:
- uses: benhodgson87/[email protected]
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitlintRulesPath: ".github/commitlint.config.js"
commitTitleMatch: "false"
ignoreCommits: "true"
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-22.04
name: Release Automation
steps:
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.LENDABOT_APP_ID }}
private-key: ${{ secrets.LENDABOT_APP_PRIVATE_KEY }}

- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ steps.generate-token.outputs.token }}
config-file: .github/release-please-config.json
manifest-file: .github/.release-please-manifest.json
include-component-in-tag: false

0 comments on commit ea9ff1f

Please sign in to comment.