changed .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Paul 2022-02-24 19:48:23 +01:00
parent ee33ee3fd6
commit 561b5be477
3 changed files with 29 additions and 170 deletions

View File

@ -1,64 +1,47 @@
---
kind: pipeline
type: docker
name: cleanup-before
name: build-linux-amd64
steps:
- name: clean
image: alpine
commands:
- rm -rf /build/*
volumes:
- name: build
path: /build
when:
event: tag
volumes:
- name: build
host:
path: /tmp/ipbl/build
---
kind: pipeline
type: docker
name: default-linux-amd64
environment:
GOOS: linux
GOARCH: amd64
GOOPTIONS: -mod=vendor
SRCFILES: cmd/ipbl/*.go
PROJECTNAME: ipbl
steps:
- name: build
image: golang
commands:
- ./ci-build.sh build
environment:
GOOS: linux
GOARCH: amd64
volumes:
- name: build
path: /build
volumes:
- name: build
host:
path: /tmp/ipbl/build
depends_on:
- cleanup-before
- go build -o $PROJECTNAME $GOOPTIONS $SRCFILES
when:
event:
exclude:
- tag
---
kind: pipeline
type: docker
name: gitea-release
name: gitea-release-linux-amd64
environment:
GOOS: linux
GOARCH: amd64
GOOPTIONS: -mod=vendor
SRCFILES: cmd/ipbl/*.go
PROJECTNAME: ipbl
steps:
- name: move
image: alpine
commands:
- mv build/* ./
volumes:
- name: build
path: /drone/src/build
image: golang
commands:
- go build -o $PROJECTNAME $GOOPTIONS $SRCFILES
- tar -czvf $PROJECTNAME-$GOOS-$GOARCH-$DRONE_TAG.tar.gz $PROJECTNAME
- echo $PROJECTNAME $DRONE_TAG > VERSION
when:
event: tag
event:
- tag
- name: release
image: plugins/gitea-release
settings:
@ -70,49 +53,6 @@ steps:
- sha256
- sha512
title: VERSION
volumes:
- name: build
path: /drone/src/build
when:
event: tag
- name: ls
image: alpine
commands:
- find .
volumes:
- name: build
path: /drone/src/build
when:
event: tag
volumes:
- name: build
host:
path: /tmp/ipbl/build
depends_on:
- default-linux-amd64
---
kind: pipeline
type: docker
name: cleanup-after
steps:
- name: clean
image: alpine
commands:
- rm -rf /build/*
volumes:
- name: build
path: /build
when:
event: tag
volumes:
- name: build
host:
path: /tmp/ipbl/build
depends_on:
- gitea-release
event:
- tag

View File

@ -1,18 +0,0 @@
# ipbl Makefile
GOCMD=go
GOBUILDCMD=${GOCMD} build
GOOPTIONS=-mod=vendor -ldflags="-s -w"
RMCMD=rm
BINNAME=ipbl
SRCFILES=cmd/ipbl/*.go
all: build
build:
${GOBUILDCMD} ${GOOPTIONS} ${SRCFILES}
clean:
${RMCMD} -f ${BINNAME}

View File

@ -1,63 +0,0 @@
#!/bin/bash
set -e
PROJECTNAME=ipbl
RELEASENAME=${PROJECTNAME}
VERSION="0"
GOOPTIONS="-mod=vendor"
SRCFILES=cmd/${PROJECTNAME}/*.go
build() {
echo "Begin of build"
if [[ ! -z ${DRONE_TAG} ]]
then
echo "Drone tag set, let's do a release"
export VERSION=${DRONE_TAG}
echo "${PROJECTNAME} ${VERSION}" > /build/VERSION
elif [[ ! -z ${DRONE_COMMIT} ]]
then
echo "Drone not set, let's only do a build"
export VERSION=${DRONE_COMMIT}
fi
if [[ ! -z ${VERSION} && ! -z ${GOOS} && ! -z ${GOARCH} ]]
then
echo "Let's set a release name"
RELEASENAME=${PROJECTNAME}-${VERSION}-${GOOS}-${GOARCH}
fi
echo "Building project"
go generate ${SRCFILES}
go build -o ${PROJECTNAME} ${GOOPTIONS} ${SRCFILES}
if [[ ! -z ${DRONE_TAG} ]]
then
echo "Let's make archives"
mkdir -p /build
tar -czvf /build/${RELEASENAME}.tar.gz ${PROJECTNAME}
fi
echo "Removing binary file"
rm ${PROJECTNAME}
echo "End of build"
}
clean() {
rm -rf ${RELEASEDIR}
}
case $1 in
"build")
build
;;
"clean")
clean
;;
*)
echo "No options choosen"
exit 1
;;
esac