Skip to content

Commit bdc28b5

Browse files
authored
fix: try fix semantic versioning (#912)
* fix: try fix semantic versioning * update README to state that conventional commits is only needed for PR title
1 parent c9ed185 commit bdc28b5

3 files changed

Lines changed: 26 additions & 38 deletions

File tree

.github/workflows/github-pages.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
name: Build and Deploy
22
on:
3-
push:
4-
tags:
5-
- 'v*'
3+
workflow_run:
4+
workflows: ["Create Release Tag"]
5+
types:
6+
- completed
7+
branches:
8+
- main
69
permissions:
710
contents: write
811
jobs:
912
build-and-deploy:
10-
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
13+
concurrency: ci-${{ github.ref }}
1114
runs-on: ubuntu-latest
15+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1216
steps:
1317
- name: Checkout
14-
uses: actions/checkout@v3
18+
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
1521

16-
- name: Extract version from tag
17-
run: echo "APP_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
22+
- name: Extract version from latest tag
23+
run: |
24+
git fetch --tags
25+
VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
26+
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
1827
1928
- name: Install and Build
2029
env:

.github/workflows/semantic-versioning.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
tag:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
with:
1717
fetch-depth: 0
1818

@@ -21,6 +21,4 @@ jobs:
2121
with:
2222
github_token: ${{ secrets.GITHUB_TOKEN }}
2323
default_bump: patch
24-
major_string_token: 'BREAKING CHANGE,!:'
25-
minor_string_token: 'feat:'
26-
patch_string_token: 'fix:,perf:,refactor:,docs:,chore:,test:'
24+
custom_release_rules: 'breaking:major,feat:minor,fix:patch,perf:patch,refactor:patch,docs:patch,chore:patch,test:patch'

CONTRIBUTING.md

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,14 @@ You can optionally open a **Draft Pull Request** earlier during development to g
7676

7777
---
7878

79-
## Commit Message Convention
80-
81-
This project follows [Conventional Commits](https://www.conventionalcommits.org/). Every commit message must start with a **type prefix**, followed by a short description written as a **verb phrase starting with a capital letter**.
82-
83-
```
84-
<type>: <Verb> <subject>
85-
```
79+
## Pull Request Guidelines
8680

87-
**Examples:**
88-
```
89-
feat: Add searchbar component
90-
fix: Resolve crash when schema is empty
91-
refactor: Extract validation logic into utility
92-
docs: Update contributing guide
93-
chore: Bump version to 2.1.0
94-
```
81+
- **Title:** Must follow the [Conventional Commits](https://www.conventionalcommits.org/) format — `<type>: <Verb> <subject>` — e.g. `feat: Add searchbar component`. This is required because the PR title is used as the squash merge commit message on `main`, from which the CI/CD pipeline automatically determines the semantic version bump and creates a release tag.
82+
- **Description:** Always explain **why** the change is needed, not just what was changed. Link the related issue.
83+
- **Scope:** Keep PRs focused on a single concern. Smaller PRs are reviewed faster and merged sooner.
84+
- **Discussion:** PRs are the primary place for code review discussion. Use inline comments and the general PR thread to ask questions and suggest improvements.
9585

96-
**Type prefixes and their effect on versioning:**
86+
**PR title type prefixes and their effect on versioning:**
9787

9888
| Prefix | Description | Version bump |
9989
|---|---|---|
@@ -104,18 +94,9 @@ chore: Bump version to 2.1.0
10494
| `docs:` | Documentation only | Patch |
10595
| `chore:` | Build process, dependencies, tooling | Patch |
10696
| `test:` | Adding or fixing tests | Patch |
107-
| `BREAKING CHANGE:` | Incompatible API change | Major (`X.0.0`) |
108-
109-
The CI/CD pipeline uses these prefixes to automatically determine the next [semantic version](https://semver.org/) when commits are merged to `main`.
97+
| `breaking:` | Incompatible API change | Major (`X.0.0`) |
11098

111-
---
112-
113-
## Pull Request Guidelines
114-
115-
- **Title:** Use the same convention as commit messages — `<type>: <Verb> <subject>`.
116-
- **Description:** Always explain **why** the change is needed, not just what was changed. Link the related issue.
117-
- **Scope:** Keep PRs focused on a single concern. Smaller PRs are reviewed faster and merged sooner.
118-
- **Discussion:** PRs are the primary place for code review discussion. Use inline comments and the general PR thread to ask questions and suggest improvements.
99+
PRs are always merged via **squash merge**, so the PR title becomes the single commit message on `main`. Individual commit messages on your branch are not required to follow the Conventional Commits format, but should still start with a verb and clearly describe what was done, e.g. `Add validation for empty schema` — this helps reviewers follow your work in the PR.
119100

120101
---
121102

0 commit comments

Comments
 (0)