Skip to content

Commit

Permalink
squash(fix): use ci templates
Browse files Browse the repository at this point in the history
  • Loading branch information
fsrv-xyz committed Apr 30, 2023
1 parent 6703d8f commit f3749e1
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit f3749e1

Please sign in to comment.