58 lines
1.7 KiB
YAML
58 lines
1.7 KiB
YAML
stages:
|
|
- build
|
|
- build docker
|
|
# - manifest
|
|
|
|
.build: &build
|
|
stage: build
|
|
cache:
|
|
paths:
|
|
- .cache
|
|
before_script:
|
|
- mkdir -p .cache
|
|
- export GOPATH="$CI_PROJECT_DIR/.cache"
|
|
- export GOCACHE="$CI_PROJECT_DIR/.cache/build"
|
|
- export GO_LDFLAGS="-linkmode external -extldflags -static -X main.Tag=$CI_COMMIT_TAG -X main.Commit=$CI_COMMIT_SHA -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`'"
|
|
- git clone https://github.com/karmanyaahm/groupme.git ./groupme
|
|
- git clone https://github.com/karmanyaahm/mautrix-go.git ./mautrix
|
|
script:
|
|
- go build -ldflags "$GO_LDFLAGS" -o go-groupme
|
|
artifacts:
|
|
paths:
|
|
- go-groupme
|
|
- example-config.yaml
|
|
|
|
.build-docker: &build-docker
|
|
image: docker:stable
|
|
stage: build docker
|
|
before_script:
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
script:
|
|
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
|
- docker build --pull --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-$DOCKER_ARCH . --file Dockerfile.ci
|
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-$DOCKER_ARCH
|
|
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-$DOCKER_ARCH
|
|
|
|
build amd64:
|
|
<<: *build
|
|
image: dock.mau.dev/tulir/gomuks-build-docker:linux-amd64
|
|
|
|
build docker amd64:
|
|
<<: *build-docker
|
|
tags:
|
|
- docker
|
|
services:
|
|
- docker:dind
|
|
dependencies:
|
|
- build amd64
|
|
needs:
|
|
- build amd64
|
|
variables:
|
|
DOCKER_ARCH: amd64
|
|
after_script:
|
|
- |
|
|
if [ "$CI_COMMIT_BRANCH" = "master" ]; then
|
|
apk add --update curl
|
|
rm -rf /var/cache/apk/*
|
|
curl "$NOVA_ADMIN_API_URL" -H "Content-Type: application/json" -d '{"password":"'"$NOVA_ADMIN_NIGHTLY_PASS"'","bridge":"'$NOVA_BRIDGE_TYPE'","image":"'$CI_REGISTRY_IMAGE':'$CI_COMMIT_SHA'-amd64"}'
|
|
fi |