discordBots/.gitlab-ci.yml
2024-02-12 17:05:56 +00:00

82 lines
1.8 KiB
YAML

.docker-build: &docker_build
# Use the official docker image.
image: docker:latest
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug)
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull --build-arg GO_CMD=${GO_CMD} -t "$CI_REGISTRY_IMAGE/${GO_CMD}${tag}" . -f Containerfile
- docker push "$CI_REGISTRY_IMAGE/${GO_CMD}${tag}"
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
changes:
- cmd/${GO_CMD}/*/**
- cmd/${GO_CMD}/*
- go.mod
- Containerfile
funbot:
stage: build
variables:
GO_CMD: funbot
<<: *docker_build
tempbot:
stage: build
variables:
GO_CMD: tempbot
<<: *docker_build
vcbot:
stage: build
variables:
GO_CMD: vcbot
<<: *docker_build
welcomebot:
stage: build
variables:
GO_CMD: welcomebot
<<: *docker_build
dealsbot:
stage: build
variables:
GO_CMD: dealsbot
<<: *docker_build
domaincheckbot:
stage: build
variables:
GO_CMD: domaincheckbot
<<: *docker_build
dcimgproxy:
stage: build
variables:
GO_CMD: dcimgproxy
<<: *docker_build
pages:
stage: build
script:
- mkdir public
- cp cmd/domaincheckbot/config/domain.json public/
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH
changes:
- cmd/domaincheckbot/config/domain.json