Go package template to reuse code and utilities.
go get -v github.com/carseven/go-package-template@v1.0.0
This step is only need if using this template from a non github remote server or private repositories
Check if already have the configuration
cat ~/.gitconfig
We should have this to be able to map example-git-repo-url.com to use SSH credentials
[url "ssh://git@example-git-repo-url.com/"]
insteadOf = https://example-git-repo-url.com/
git config --global ssh://git@example-git-repo-url.com/:.insteadOf https://example-git-repo-url.com/
For Go modules to work (with Go 1.11 or newer), you'll also need to set the GOPRIVATE variable, to avoid using the public servers to fetch the code:
Check GOPRIVATE value
go env | grep GOPRIVATE
Add go private https://example-git-repo-url.com/
All repositories of a URL
go env -w GOPRIVATE="example-git-repo-url.com/*"
or just this repo
go env -w GOPRIVATE="example-git-repo-url.com/specific-repository-name/common"
Follow the semantic versioning for updating the package versions. For more detail, follow the GO guide.
For updating the package version, just create new tags following SemVer.
Use the merge commit message to set the version bump. Make sure to follow this rules:
Manual Bumping: Any commit message that includes #major
, #minor
, #patch
, or #none
will trigger the respective version bump. If two or more are present, the highest-ranking one will take precedence.
If #none
is contained in the merge commit message, it will skip bumping regardless DEFAULT_BUMP
.
Automatic Bumping: If no #major
, #minor
or #patch
tag is contained in the merge commit message, it will bump whichever DEFAULT_BUMP
is set to (which is patch
by default).
Note: This action will not bump the tag if the
HEAD
commit has already been tagged.
Make sure you are on main branch and the branch is up to date.
git switch main
git fetch --all
git pull
Create a new version to main HEAD commit.
git tag v1.0.0
Push new version to origin/main:
git push --tags
From github you could also create a new version and tag. For more detail, follow the github guide.