Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#148): add automatic releases and versioning #152

Merged
merged 12 commits into from
Aug 27, 2024
26 changes: 26 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Conventional commits
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened

jobs:
lint_pr_title:
name: Lint PR title
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install commitlint
run: |
npm install @commitlint/config-conventional
npm install commitlint@latest
- name: Lint title
run: npx --no -- commitlint <<< "${{ github.event.pull_request.title }}"
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install Semantic Release and plugins
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/github @semantic-release/commit-analyzer @semantic-release/release-notes-generator
njuguna-n marked this conversation as resolved.
Show resolved Hide resolved
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }}
run: npx semantic-release
22 changes: 22 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
]
}
],
"@semantic-release/github"
]
}
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,26 @@ Follow the instructions in [the Local CHT Sync Setup documentation](https://docs
# set environment variables, install dbt dependencies, seed data, run dbt, run test
./run_dbt_tests.sh
```

## Release Process
This repo has an automated release process where each feature/bug fix will be released immediately after it is merged to `main`:

1. Update QA with the work to be done to ensure they're informed and can guide development.
njuguna-n marked this conversation as resolved.
Show resolved Hide resolved
2. Create a ticket for the feature/bug fix.
3. Submit a PR, and make sure that the PR title is clear, readable, and follows the strict commit message format described in the commit message format section below. If the PR title does not comply, automatic release will fail.
4. Have the PR reviewed.
5. Squash and merge the PR to `main`. The commit message should be the already-formatted PR title but double check that it's clear, readable, and follows the strict commit message format to make sure the automatic release works as expected.
6. Close the ticket.

### Commit message format

The commit format should follow the convention outlined in the [CHT docs](https://docs.communityhealthtoolkit.org/contribute/code/workflow/#commit-message-format).
Examples are provided below.

| Type | Example commit message | Release type |
|-------------|-----------------------------------------------------------------------------------------------------|--------------|
| Bug fixes | fix(#123): rename column names | patch |
| Performance | perf(#789): add new indexes | patch |
| Features | feat(#456): add new model | minor |
| Non-code | chore(#123): update README | none |
| Breaking | perf(#2): remove data_record model <br/> BREAKING CHANGE: form models should now read from new_model| major |
2 changes: 2 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = { extends: ['@commitlint/config-conventional'] };

Loading