homepage/.drone.yml

66 lines
1.7 KiB
YAML

kind: pipeline
name: homepage
steps:
- name: build
image: gcr.io/kaniko-project/executor:v1.9.0-debug
environment:
DOCKER_USERNAME:
from_secret: registry_username
DOCKER_PASSWORD:
from_secret: registry_password
DOCKER_REGISTRY: codeberg.org
IMAGE_BASE: codeberg.org/angestoepselt/homepage
commands:
- echo "{\"auths\":{\"$DOCKER_REGISTRY\":{\"username\":\"$DOCKER_USERNAME\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
- if [ "$DRONE_BRANCH" = "main" ]; then export TAG="main"; else export TAG="stage"; fi
- /kaniko/executor --cache --cache-dir=/cache --context . --destination "$IMAGE_BASE/angestoepselt:$TAG" --build-arg SITE=angestoepselt
- /kaniko/executor --cache --cache-dir=/cache --context . --destination "$IMAGE_BASE/coderdojo:$TAG" --build-arg SITE=coderdojo
- name: deploy staging
image: plugins/webhook
settings:
urls:
from_secret: portainer_stage_url
depends_on:
- build
when:
branch:
exclude:
- main
- name: deploy production
image: plugins/webhook
settings:
urls:
from_secret: portainer_main_url
depends_on:
- build
when:
branch:
- main
- name: send notification
image: plugins/webhook
settings:
urls:
from_secret: DRONE_WEBHOOK_ENDPOINT
username: drone
password:
from_secret: DRONE_WEBHOOK_SECRET
content_type: application/json
template: |
{
"branch": "{{ build.branch }}",
"author": "{{ build.author }}",
"event": "{{ build.event }}",
"status": "{{ build.status }}",
"owner": "{{ repo.owner }}",
"repo": "{{ repo.name }}"
}
depends_on:
- deploy production
trigger:
event:
- push