Compare commits

5 Commits
1.0.0 ... main

Author SHA1 Message Date
232c4a1eb7 Update README.md 2024-06-25 14:49:59 +00:00
31f37f73cb Update README.md 2023-10-31 06:40:55 +00:00
4eb5cc0564 Update README.md 2023-10-31 06:40:13 +00:00
4672526676 Update README.md 2023-10-31 06:36:52 +00:00
bfdbec97e9 Update .gitlab-ci.yml file 2023-10-30 12:02:48 +00:00
2 changed files with 48 additions and 0 deletions

13
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,13 @@
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
stages:
- test
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml

View File

@@ -21,3 +21,38 @@ tracked files, the diff will be hashed and added to the metadata.
Tags which begin with a 'v' will have it removed when evaluating the tag as a Tags which begin with a 'v' will have it removed when evaluating the tag as a
version. version.
## Usage
Add it to your project as a submodule:
```bash
git submodule add https://git.sdf.org/CRThaze/git-semver-compute.git .version
```
### Makefile
Easily make the current version available in your Makefile like so:
```make
# Use the ?= to allow the version to be overriden easily by passing it in as
# an environment or build variable.
VERSION ?= $(shell ./.version/calculate-version.sh)
$(EXECUTABLE):
go build -ldflags="-X main.Version=$(VERSION)" -o $(EXECUTABLE) .
```
### Github Actions
```yaml
on: [push]
jobs:
build:
steps:
- name: Compute SemVer from Tags and Commits
id: version
run: echo "VERSION=$(${PWD}/.version/calculate-version.sh)" >> $GITHUB_OUTPUT
- name: Create Archive
run: tar -czf mycode-${{ steps.version.outputs.VERSION }}.tar.gz .
```