104 lines
2.5 KiB
YAML
104 lines
2.5 KiB
YAML
kind: pipeline
|
|
name: default
|
|
type: docker
|
|
|
|
steps:
|
|
- name: restore-cache
|
|
image: drillster/drone-volume-cache
|
|
settings:
|
|
restore: true
|
|
mount:
|
|
- /drone/src/.gradle-cache
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
|
|
- name: build
|
|
image: openjdk:16
|
|
commands:
|
|
- ./gradlew --no-daemon --build-cache clean assemble
|
|
environment:
|
|
GRADLE_USER_HOME: /drone/src/.gradle-cache
|
|
ORG_GRADLE_PROJECT_BUILD_VERSION: ${DRONE_TAG}
|
|
|
|
- name: deploy
|
|
image: openjdk:16
|
|
commands:
|
|
- ./gradlew --no-daemon --info --build-cache jib
|
|
settings:
|
|
use_cache: true
|
|
volumes:
|
|
- name: docker_config
|
|
path: /root/.docker/config.json
|
|
environment:
|
|
GRADLE_USER_HOME: /drone/src/.gradle-cache
|
|
ORG_GRADLE_PROJECT_DOCKER_REGISTRY:
|
|
from_secret: DOCKER_REPO
|
|
ORG_GRADLE_PROJECT_BUILD_VERSION: ${DRONE_TAG}
|
|
|
|
- name: rebuild-cache
|
|
image: drillster/drone-volume-cache
|
|
settings:
|
|
rebuild: true
|
|
mount:
|
|
- /drone/src/.gradle-cache
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
|
|
- name: prepare-infra
|
|
image: drone/git
|
|
commands:
|
|
- git clone --depth=1 https://$${GITHUB_USERNAME}:$${GITHUB_PUSH_TOKEN}@github.com/devsoap/infrastructure.git infra
|
|
- cd infra
|
|
- sed -i -r "s|$${IMAGE}:(.*?)|$${IMAGE}:$${TAG}|g" $${STACK}/docker-compose.yml
|
|
- git diff -U0
|
|
environment:
|
|
STACK: ahlroos.me
|
|
IMAGE: com.devsoap/pdf-parsers
|
|
TAG: ${DRONE_TAG}
|
|
GITHUB_USERNAME:
|
|
from_secret: GITHUB_USERNAME
|
|
GITHUB_PUSH_TOKEN:
|
|
from_secret: GITHUB_PUSH_TOKEN
|
|
|
|
- name: publish-to-production
|
|
image: maniack/drone-portainer
|
|
settings:
|
|
portainer:
|
|
from_secret: PORTAINER_URL
|
|
username:
|
|
from_secret: PORTAINER_USER
|
|
password:
|
|
from_secret: PORTAINER_PASSWORD
|
|
endpoint: ahlroos.me
|
|
stack: ahlroos_me
|
|
file: infra/ahlroos.me/docker-compose.yml
|
|
environment:
|
|
DEBUG: true
|
|
|
|
- name: save-infra
|
|
image: drone/git
|
|
commands:
|
|
- cd infra
|
|
- git diff -U0
|
|
- git commit -am "Updated $${STACK}/$${SERVICE} to $${TAG}"
|
|
- git push origin master
|
|
environment:
|
|
SERVICE: pdf-parsers
|
|
STACK: ahlroos.me
|
|
TAG: ${DRONE_TAG}
|
|
GITHUB_USERNAME:
|
|
from_secret: GITHUB_USERNAME
|
|
GITHUB_PUSH_TOKEN:
|
|
from_secret: GITHUB_PUSH_TOKEN
|
|
|
|
trigger:
|
|
ref:
|
|
include:
|
|
- refs/tags/**
|
|
|
|
volumes:
|
|
- name: docker_config
|
|
host:
|
|
path: /root/.docker/config.json |