-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
614 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,15 @@ | ||
{ | ||
name: simver, | ||
concurrency: { group: simver, cancel-in-progress: false }, | ||
permissions: { id-token: write, contents: write, pull-requests: read }, | ||
on: | ||
{ | ||
workflow_dispatch: null, | ||
workflow_call: {}, | ||
push: { branches: [main] }, | ||
pull_request: { types: [opened, synchronize, reopened, closed] }, | ||
}, | ||
defaults: { run: { shell: bash } }, | ||
jobs: | ||
{ | ||
simver: | ||
{ | ||
runs-on: ubuntu-latest, | ||
|
||
steps: | ||
[ | ||
{ | ||
name: checkout code, | ||
uses: "actions/checkout@v4", | ||
with: { fetch-depth: 0 }, | ||
}, | ||
{ | ||
name: setup golang, | ||
uses: "actions/setup-go@v4", | ||
with: { go-version: 1.21.4 }, | ||
}, | ||
{ | ||
name: install simver, | ||
run: "go install github.com/walteh/simver/cmd/simver_github_actions@v0.22.0", | ||
}, | ||
{ | ||
name: run simver, | ||
id: simver, | ||
env: | ||
{ | ||
SIMVER_READ_ONLY: false, | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}", | ||
}, | ||
run: simver_github_actions, | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
name: simver | ||
permissions: { id-token: write, contents: write, pull-requests: read } | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, synchronize, reopened, closed] | ||
jobs: | ||
simver: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: walteh/simver/cmd/gha-simver@a9f89e2fb17b03b3150c2aed050a68bc85280f02 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: wait-on-simver | ||
permissions: { id-token: write, contents: write, pull-requests: read } | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: ["*"] | ||
jobs: | ||
wait-on-simver: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: walteh/simver/cmd/gha-wait-on-simver@a9f89e2fb17b03b3150c2aed050a68bc85280f02 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,79 @@ | ||
# simver | ||
simple, pr based, semver git tagging logic | ||
# SimVer - Semantic Versioning Simplified 🔄 | ||
|
||
## 🌟 Overview | ||
|
||
# definitions | ||
Forget about the headache of manual versioning. SimVer is here to automate and simplify semantic versioning in your Git workflow. By managing version tags directly linked to your commit activities, SimVer ensures a linear, predictable version history with zero manual overhead. Perfect for teams and developers looking for a set-it-and-forget-it solution, SimVer streamlines your development process, allowing you to focus on what truly matters - building great software. | ||
|
||
# how can we make sure that a version is reserved - and if it is not reserved we need to bump it | ||
## 🎯 Target Audience | ||
|
||
SimVer is the go-to solution for developers and teams who: | ||
|
||
## when is mmrt valid? | ||
1. it exists | ||
2. it is higher than the mrlt | ||
- Are exhausted by manual versioning complexities. | ||
- Desire a consistent, traceable version history. | ||
- Need seamless integration with CI/CD tools like GitHub Actions. | ||
|
||
## ✨ Features | ||
|
||
## the most recent reserved tag (mrrt) | ||
- **Automated Version Tags:** Automatically generates semantic version tags for all commits and pull requests. | ||
- **Clear Versioning Rules:** Simplifies decision-making with straightforward rules for main and side branches. | ||
- **Linear History Dependence:** Ensures all version increments are predictable and orderly. | ||
|
||
inside this commits tree, the highest 'vX.Y.Z-reserved' tag is the mrrt. | ||
## 📘 How It Works | ||
|
||
### Versioning Logic Simplified | ||
|
||
## the most recent live tag (mrlt) | ||
- **Direct Pushes to Main:** Trigger minor version updates automatically. | ||
- **Pull Requests:** | ||
- To Main: Trigger minor updates. | ||
- To Side Branches: Apply patch updates. | ||
- Multiple Concurrent PRs: Ensure unique, sequential versioning without conflicts. | ||
- **Merging:** Versions merge seamlessly, with the target branch adopting the version from the merged branch or PR. | ||
|
||
inside this commits tree, the highest 'vX.Y.Z' tag is the mrlt. | ||
### Tagging Made Easy | ||
|
||
## the my most recent tag (mmrt) | ||
- **Main Branch:** Receives clean, full release versions. | ||
- **Side Branches and PRs:** Get detailed pre-release tags to avoid confusion and maintain clarity. | ||
|
||
inside this commits tree, the highest 'vX.Y.Z-pr.N+base' tag is the mmrt. | ||
### Real-world Examples | ||
|
||
## next valid tag (nvt) | ||
- Direct push to `main` changes `v1.0.0` to `v1.1.0`. | ||
- A PR to `main` updates from `v1.0.0` to `v1.1.0`. | ||
- A PR to a side branch updates from `v1.1.0` to `v1.1.1`. | ||
- Handling multiple PRs ensures sequential updates without overlap. | ||
|
||
find the latest mrrt or mrlt and increment the patch number (or minor if the base branch is main) | ||
## 🚀 Getting Started | ||
|
||
## the my most recent build number (mmrbn) | ||
### Usage | ||
|
||
inside this commits tree, the highest '*-pr.N+(this)' is the mmrbn. | ||
Easily integrate SimVer into your GitHub Actions with this setup: | ||
|
||
note each of the nvt, mrrt, mrlt, and mmrt are saved as valid semvers, so "X.Y.Z" | ||
the mmrbn is an integer, so "N" | ||
```yaml | ||
name: simver | ||
permissions: { id-token: write, contents: write, pull-requests: read } | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, synchronize, reopened, closed] | ||
jobs: | ||
simver: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: walteh/simver/cmd/gha-simver@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
------------ | ||
## ⚠️ Current Limitations & 🛠 Future Fixes | ||
two bugs: | ||
- need to make sure merges do not have build numbers | ||
- need to make sure that build nums are picked up | ||
- **Junk Tags Cleanup:** Upcoming feature to clear temporary tags automatically. | ||
- **Force Push Handling:** We're improving how version recalculations handle force pushes to maintain accurate histories. | ||
# probs to test | ||
1. make sure that a new pr to main does a minor bump | ||
2. make sure that a new pr not to main does a patch bump | ||
3. make sure that a new commit to a pr who has been tagged with a version and was last used for it does a patch bump | ||
1. make sure if reserved is set, but others are not that it does not loop infinitely | ||
## 🤝 Contributing | ||
Contributions are welcome! Fork, modify, and submit a pull request. | ||
# process | ||
|
||
## when to run the workflow | ||
1. for every commit on main | ||
2. for every pr event | ||
|
||
### 1. for each pr event: | ||
1. figure out if head commit is a pr merge, commit, or nothing | ||
- check if the current head has a semver tag | ||
- if it does, then it is a nothing | ||
- check if the commit message contains "(#N)" where N is a number and the pr exists and the head commit is the current commit | ||
- if it is, then it is a pr merge | ||
- if it is not, then it is a normal commit | ||
|
||
#### 1. if nothing: | ||
1. do nothing | ||
|
||
#### 2. if pr merge: | ||
1. find the mrrt, mrlt, and mmrt | ||
2. check if the mmrt is valid | ||
3. if it is, move forward with the mmrt | ||
4. if it is not, use the nvt | ||
- create two new tags on the base commit | ||
- vX.Y.Z-reserved | ||
- vX.Y.Z-pr.N+base | ||
5. create a new tag on the head commit | ||
|
||
#### 3. if a normal commit: | ||
1. find the mrrt and mrlt, calculate the nvt | ||
2. create a new tag (based on nvt) on the head commit | ||
|
||
### 2. for each commit on main: | ||
1. figure out if head is a pr merge or not | ||
- check if the commit message contains "(#N)" where N is a number and the pr exists and the head commit is the current commit | ||
- if it is, then it is a pr merge | ||
- if it is not, then it is a normal commit | ||
|
||
#### 1. if pr merge: | ||
1. find the mrrt, mrlt, and mmrt | ||
2. check if the mmrt is valid | ||
3. if it is, move forward with the mmrt | ||
4. if it is not, use the nvt | ||
- create two new tags on the base commit (for brevity) - get the base commit from the pr | ||
- vX.Y.Z-reserved | ||
- vX.Y.Z-pr.N+base | ||
5. create a new tag on the head commit with no build number or prerelease | ||
|
||
#### 2. if a normal commit: | ||
1. find the mrrt and mrlt, calculate the nvt | ||
2. create a new tag (based on nvt) on the head commit with no build number or prerelease | ||
|
||
when you merge a pr: | ||
- find the mmrt or the pr branch, and we need to start using that for this branch | ||
- the base branch should inherit the mmrt from the pr branch | ||
- so we need to create: | ||
1. a new "base" tag for the base branch with the mmrt of the pr branch | ||
2. create a new build tag using the mmrt | ||
## 📜 License | ||
Distributed under the MIT License. See `LICENSE` for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.