Files
reloading-manager/backend/.gitlab-ci.yml
2025-04-16 12:47:04 -04:00

35 lines
774 B
YAML

stages:
- test
- build
variables:
IMAGE_URL: siteworxpro/
IMAGE_NAME: reloading-backend
Unit Tests:
stage: test
only:
- branches
image: siteworxpro/golang:1.24.0
before_script:
- go mod tidy
script:
- go test ./...
Build:
stage: build
dependencies:
- Unit Tests
only:
- master
image: docker:dind
before_script:
- docker login -u siteworxpro -p ${DOCKER_TOKEN}
script:
- TAG=${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}
- docker build -t ${IMAGE_NAME} .
- docker tag ${IMAGE_NAME}:latest ${IMAGE_URL}${IMAGE_NAME}:latest
- docker tag ${IMAGE_URL}${IMAGE_NAME}:latest ${IMAGE_URL}${IMAGE_NAME}:${TAG}
- docker push ${IMAGE_URL}${IMAGE_NAME}:${TAG}
- docker push ${IMAGE_URL}${IMAGE_NAME}:latest