cloudron-drone-app/.drone.yml
Felix Bartels eb46932157 only push the image on promote
Signed-off-by: Felix Bartels <felix@host-consultants.de>
2020-12-11 09:55:47 +01:00

57 lines
1.5 KiB
YAML

---
kind: pipeline
type: docker
name: default
steps:
- name: set version
image: golang:1.12
commands:
- "current_version=$(grep drone/drone: Dockerfile | cut -d' ' -f 2 | cut -d: -f 2)"
- timestamp=$(date +%s)
- echo -n "$current_version-$timestamp" > .tags
- name: docker build
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- docker ps -a
- docker build -t fbartels/com.github.drone:latest .
- name: docker push
image: docker:dind
volumes:
- name: dockersock
path: /var/run
environment:
DOCKER_USERNAME: {from_secret: DOCKER_USERNAME}
DOCKER_PASSWORD: {from_secret: DOCKER_PASSWORD}
commands:
- current_version=$(cat .tags)
- docker tag fbartels/com.github.drone:latest fbartels/com.github.drone:$current_version
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- docker push fbartels/com.github.drone:latest
- docker push fbartels/com.github.drone:$current_version
when:
branch:
- master
event:
- promote
- name: cloudron update
image: fbartels/cloudron-cli:latest
environment:
CLOUDRON_SERVER: {from_secret: CLOUDRON_SERVER}
CLOUDRON_TOKEN: {from_secret: CLOUDRON_TOKEN}
commands:
- current_version=$(cat .tags)
- cloudron update --server $CLOUDRON_SERVER --token $CLOUDRON_TOKEN --app drone --image fbartels/com.github.drone:$current_version
when:
branch:
- master
event:
- promote
volumes:
- name: dockersock
host:
path: /var/run/