-
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.
Refactor/version migrate to file based versioning (#6)
* Added version.txt and corresponding handler. And fixed relative path issue caused by the change * Added workflow for static version model. * Fixed version handling in the Makefile. * versioning and tagging workflow docs added
- Loading branch information
Showing
10 changed files
with
119 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Tag on Version Change | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- "version/version.txt" | ||
|
||
jobs: | ||
create_tag: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Read version from version.txt | ||
id: read_version | ||
run: | | ||
VERSION=$(cat version/version.txt) | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Create and push tag | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}" | ||
git push origin "v${{ env.VERSION }}" |
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
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
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
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,27 @@ | ||
package version | ||
|
||
import ( | ||
"embed" | ||
"log" | ||
"strings" | ||
) | ||
|
||
var ( | ||
// Version is loaded from version.txt file | ||
version = loadVersionFromFile() | ||
|
||
//go:embed version.txt | ||
embedFS embed.FS | ||
) | ||
|
||
func GetVersion() string { | ||
return version | ||
} | ||
|
||
func loadVersionFromFile() string { | ||
data, err := embedFS.ReadFile("version.txt") | ||
if err != nil { | ||
log.Fatalf("Failed to read version file: %v", err) | ||
} | ||
return strings.TrimSpace(string(data)) | ||
} |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
v1.0.0-rc |