diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6944d6f..8bbbbf3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +1,23 @@ --- -default: - image: golang:latest - stages: - test - build - release -format: +variables: + SEMVER_PREFIX: v + +.go_template_defaults: stage: test - script: - - go fmt $(go list ./... | grep -v /vendor/) - - go vet $(go list ./... | grep -v /vendor/) - - go test -race $(go list ./... | grep -v /vendor/) +.semver_template_defaults: + stage: release +include: + - { project: bonsai-oss/organization/automate/ci-templates, file: templates/language/go.yml } + - { project: bonsai-oss/organization/automate/ci-templates, file: templates/release/semver.yml } compile: stage: build + image: golang:1.20.3-bullseye script: - mkdir -p binaries - go build -o binaries/openzfs_exporter-$(uname -s) ./cmd/openzfs_exporter/*.go @@ -26,18 +28,4 @@ compile: - freebsd artifacts: paths: - - binaries - -semantic_release: - stage: release - image: registry.fsrv.services/fsrvcorp/container/payipi:latest - variables: - GIT_STRATEGY: clone - GIT_DEPTH: 0 - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - script: - - get-next-version -f json - - VERSION="$(get-next-version -f json | jq -r 'select(.hasNextVersion==true) | .version')" - - echo $VERSION - - test -z "$VERSION" || curl --silent --request POST --header "PRIVATE-TOKEN:${CI_BOT_TOKEN}" "https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/repository/tags?tag_name=v${VERSION}&ref=${CI_DEFAULT_BRANCH}" | jq + - binaries \ No newline at end of file