updated ci related files
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
29121791cb
commit
ae53567fd7
127
.drone.yml
127
.drone.yml
@ -1,14 +1,30 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: cleanup-before
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clean
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- rm -rf /build/*
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
path: /build
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
host:
|
||||||
|
path: /tmp/dip/build
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default-linux-amd64
|
name: default-linux-amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: packr2
|
|
||||||
image: golang
|
|
||||||
commands:
|
|
||||||
- go get -u github.com/gobuffalo/packr/v2/packr2
|
|
||||||
- go build -o packr2 -mod=mod github.com/gobuffalo/packr/v2/packr2
|
|
||||||
- name: build
|
- name: build
|
||||||
image: golang
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
@ -16,18 +32,17 @@ steps:
|
|||||||
environment:
|
environment:
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
- name: release
|
volumes:
|
||||||
image: plugins/gitea-release
|
- name: build
|
||||||
settings:
|
path: /build
|
||||||
base_url: https://git.paulbsd.com
|
|
||||||
api_key:
|
volumes:
|
||||||
from_secret: gitea_token
|
- name: build
|
||||||
files: "*.tar.gz"
|
host:
|
||||||
checksum:
|
path: /tmp/dip/build
|
||||||
- sha256
|
|
||||||
- sha512
|
depends_on:
|
||||||
when:
|
- cleanup-before
|
||||||
event: tag
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@ -35,11 +50,6 @@ type: docker
|
|||||||
name: default-linux-arm64
|
name: default-linux-arm64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: packr2
|
|
||||||
image: golang
|
|
||||||
commands:
|
|
||||||
- go get -u github.com/gobuffalo/packr/v2/packr2
|
|
||||||
- go build -o packr2 -mod=mod github.com/gobuffalo/packr/v2/packr2
|
|
||||||
- name: build
|
- name: build
|
||||||
image: golang
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
@ -47,6 +57,33 @@ steps:
|
|||||||
environment:
|
environment:
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: arm64
|
GOARCH: arm64
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
path: /build
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
host:
|
||||||
|
path: /tmp/dip/build
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- cleanup-before
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: gitea-release
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: move
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- mv build/* ./
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
path: /drone/src/build
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
- name: release
|
- name: release
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
settings:
|
settings:
|
||||||
@ -57,5 +94,51 @@ steps:
|
|||||||
checksum:
|
checksum:
|
||||||
- sha256
|
- sha256
|
||||||
- sha512
|
- sha512
|
||||||
|
title: VERSION
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
path: /drone/src/build
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
|
- name: ls
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- find .
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
path: /drone/src/build
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: build
|
||||||
|
host:
|
||||||
|
path: /tmp/dip/build
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- default-linux-amd64
|
||||||
|
- default-linux-arm64
|
||||||
|
|
||||||
|
---
|
||||||
|
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/dip/build
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- gitea-release
|
||||||
|
26
ci-build.sh
26
ci-build.sh
@ -5,41 +5,45 @@ RELEASENAME=${PROJECTNAME}
|
|||||||
VERSION="0"
|
VERSION="0"
|
||||||
|
|
||||||
GOOPTIONS="-mod=vendor"
|
GOOPTIONS="-mod=vendor"
|
||||||
SRCFILES=cmd/${PROJECTNAME}/*.go
|
SRCFILES=cmd/dip/*.go
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
echo "Begin of build"
|
||||||
if [[ ! -z $DRONE_TAG ]]
|
if [[ ! -z $DRONE_TAG ]]
|
||||||
then
|
then
|
||||||
|
echo "Drone tag set, let's do a release"
|
||||||
VERSION=$DRONE_TAG
|
VERSION=$DRONE_TAG
|
||||||
|
echo "${PROJECTNAME} ${VERSION}" > /build/VERSION
|
||||||
elif [[ ! -z $DRONE_TAG ]]
|
elif [[ ! -z $DRONE_TAG ]]
|
||||||
then
|
then
|
||||||
|
echo "Drone not set, let's only do a build"
|
||||||
VERSION=$DRONE_COMMIT
|
VERSION=$DRONE_COMMIT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z $VERSION && ! -z $GOOS && ! -z $GOARCH ]]
|
if [[ ! -z $VERSION && ! -z $GOOS && ! -z $GOARCH ]]
|
||||||
then
|
then
|
||||||
|
echo "Let's set a release name"
|
||||||
RELEASENAME=${PROJECTNAME}-${VERSION}-${GOOS}-${GOARCH}
|
RELEASENAME=${PROJECTNAME}-${VERSION}-${GOOS}-${GOARCH}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running packr2"
|
echo "Getting packr2 and building embedded files"
|
||||||
if [[ -f ./packr2 ]]
|
go get -u github.com/gobuffalo/packr/v2/packr2
|
||||||
then
|
packr2
|
||||||
./packr2
|
|
||||||
else
|
|
||||||
echo "packr2 binary not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Building project"
|
echo "Building project"
|
||||||
go build -o ${PROJECTNAME} ${GOOPTIONS} ${SRCFILES}
|
go build -o ${PROJECTNAME} ${GOOPTIONS} ${SRCFILES}
|
||||||
|
|
||||||
if [[ ! -z $DRONE_TAG ]]
|
if [[ ! -z $DRONE_TAG ]]
|
||||||
then
|
then
|
||||||
tar -czvf ${RELEASENAME}.tar.gz ${PROJECTNAME}
|
echo "Let's make archives"
|
||||||
|
mkdir -p /build
|
||||||
|
tar -czvf /build/${RELEASENAME}.tar.gz ${PROJECTNAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Removing binary file"
|
echo "Removing binary file"
|
||||||
rm ${PROJECTNAME}
|
rm ${PROJECTNAME}
|
||||||
|
|
||||||
|
echo "End of build"
|
||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
@ -54,5 +58,7 @@ case $1 in
|
|||||||
clean
|
clean
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
echo "No options choosen"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
Loading…
Reference in New Issue
Block a user