Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carseven/go-package-template
A GO package template. Ready to use github action to bump version using Sematic Versioning and CI for lauching test
https://github.com/carseven/go-package-template
ci ci-cd cicd go golang packa template
Last synced: about 1 month ago
JSON representation
A GO package template. Ready to use github action to bump version using Sematic Versioning and CI for lauching test
- Host: GitHub
- URL: https://github.com/carseven/go-package-template
- Owner: carseven
- Created: 2024-01-11T19:08:20.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-12T19:53:51.000Z (12 months ago)
- Last Synced: 2024-06-21T20:09:33.073Z (6 months ago)
- Topics: ci, ci-cd, cicd, go, golang, packa, template
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-package-template
Go package template to reuse code and utilities.
# Install package
```shell
go get -v github.com/carseven/[email protected]
```## Install configuration for private repositories
### Configure git to use ssh credentials for private remote repository (Not Github) (Optional)
This step is only need if using this template from a non github remote server or private repositories
Check if already have the configuration
```shell
cat ~/.gitconfig
```We should have this to be able to map example-git-repo-url.com to use SSH credentials
```shell
[url "ssh://[email protected]/"]
insteadOf = https://example-git-repo-url.com/
``````shell
git config --global ssh://[email protected]/:.insteadOf https://example-git-repo-url.com/
```### Configure GOPRIVATE
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
```shell
go env | grep GOPRIVATE
```Add go private https://example-git-repo-url.com/
All repositories of a URL
```shell
go env -w GOPRIVATE="example-git-repo-url.com/*"
```or just this repo
```shell
go env -w GOPRIVATE="example-git-repo-url.com/specific-repository-name/common"
```# Versioning
Follow the semantic versioning for updating the package versions. For more detail, follow the GO [guide](https://go.dev/doc/modules/version-numbers).
## Tags
For updating the package version, just create new tags following SemVer.
### PR
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.
### Manual
Make sure you are on main branch and the branch is up to date.
```shell
git switch main
git fetch --all
git pull
```Create a new version to main HEAD commit.
```shell
git tag v1.0.0
```Push new version to origin/main:
```shell
git push --tags
```### Github releases
From github you could also create a new version and tag. For more detail, follow the github [guide](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).