From bb7c8544961817a4d108059d774f09fe1feddd96 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 11 Sep 2024 21:32:46 +1000 Subject: [PATCH] add drone cicd --- .drone.sh | 12 ++++++++++++ .drone.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .drone.sh create mode 100644 .drone.yml diff --git a/.drone.sh b/.drone.sh new file mode 100644 index 0000000..a37e06e --- /dev/null +++ b/.drone.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# disable CGO for cross-compiling +export CGO_ENABLED=0 + +export now=$(TZ=Australia/Sydney date '+%Y%m%d-%H%M%S') +echo $now +echo "build commences" +go build -ldflags "-X main.sha1ver=`git rev-parse HEAD` -X main.buildTime=$now" -o vctp cmd/api/main.go +echo "build complete" +sha256sum vctp > vctp_checksum.txt +ls -lah \ No newline at end of file diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..a902687 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,40 @@ +kind: pipeline +type: docker +name: default + +steps: +- name: build + image: golang + environment: + CGO_ENABLED: 0 + GOMODCACHE: '/drone/src/pkg.mod' + GOCACHE: '/drone/src/pkg.build' + volumes: + - name: shared + path: /shared + commands: + #- cp /shared/index.html ./www/ + - sh ./.drone.sh + +- name: dell-sftp-deploy + image: hypervtechnics/drone-sftp + settings: + host: deft.dell.com + username: + from_secret: DELLFTP_USER + password: + from_secret: DELLFTP_PASS + port: 22 + source: ./ + filter: vctp* + clean: false + target: / + overwrite: true + verbose: true + +volumes: +- name: shared + temp: {} +#- name: cache +# host: +# path: /var/lib/cache \ No newline at end of file