ci: add ci

This commit is contained in:
Michael Grote 2023-06-28 14:21:27 +02:00
commit 3d37be9c22

50
.drone.yml Normal file
View file

@ -0,0 +1,50 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: run gitleaks
image: plugins/gitleaks
settings:
path: .
- name: build
image: ubuntu:22
environment:
DEBIAN_FRONTEND: noninteractive
commands:
- git clone https://git.mgrote.net/Mirror/sanoid.git
- cd sanoid
- # checkout latest stable release or stay on master for bleeding edge stuff (but expect bugs!)
- git checkout $(git tag | grep "^v" | tail -n 1)
- ln -s packages/debian .
- dpkg-buildpackage -uc -us
- ls -lahR
- pwd
- BUILD_DIR="./tmp"
- OUTPUT_DIR="./output"
- GIT_COMMIT_ID=$(git rev-parse --short HEAD) # git-commit-id: z.B. 39d35da
- VERSION=$(git rev-list --all --count) # Anzahl aller Commits (int)
- GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) # branch-Name
- name: upload
image: registry.mgrote.net/allzweckcontainer:latest # privates Image, Pull-Secret notwendig
environment:
DEBIAN_FRONTEND: noninteractive
auth_token:
from_secret: httpd-api-server-token
commands:
- pwd
- ls -lah ./sanhoid/output/
# upload
- |
curl -X POST -H "token: $auth_token" -F "file=@./sanhoid/output/sanhoid-${DRONE_COMMIT_SHA:0:8}.tar.gz" http://docker10.grote.lan:5040/upload
- |
curl -X POST -H "token: $auth_token" -F "file=@./sanhoid/output/sanhoid-${DRONE_COMMIT_BRANCH}.tar.gz" http://docker10.grote.lan:5040/upload
- |
curl -X POST -H "token: $auth_token" -F "file=@./sanhoid/output/sanhoid-latest.tar.gz" http://docker10.grote.lan:5040/upload
image_pull_secrets: # wird für den Login auf registry.mgrote.net benötigt
- dockerconfigjson
# siehe: https://wiki.mgrote.net/artikel/technik/drone.io_-_pull_secrets