This commit is contained in:
105
.drone.yml
105
.drone.yml
@@ -1,34 +1,95 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
name: Build and Deploy Pipeline
|
||||
|
||||
workspace:
|
||||
path: /drone/mail-autoconfig
|
||||
|
||||
steps:
|
||||
- name: build-and-push
|
||||
- name: Build and Publish Docker Image
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: registry.your-gitea.com/your-org/mail-autoconfig
|
||||
tags: latest
|
||||
username:
|
||||
from_secret: GITEA_USERNAME
|
||||
auto_tag: true
|
||||
repo: git.mifi.dev/mifi/mail-autoconfig
|
||||
registry: git.mifi.dev
|
||||
username: <token>
|
||||
password:
|
||||
from_secret: GITEA_TOKEN
|
||||
from_secret: gitea_package_token
|
||||
secrets: [gitea_package_token]
|
||||
|
||||
- name: deploy-to-portainer
|
||||
image: curlimages/curl:7.85.0
|
||||
environment:
|
||||
PORTAINER_URL: https://portainer.mail.mifi.holdings
|
||||
PORTAINER_API_KEY:
|
||||
from_secret: PORTAINER_API_KEY
|
||||
ENDPOINT_ID:
|
||||
from_secret: PORTAINER_ENDPOINT_ID # e.g. "1"
|
||||
STACK_ID:
|
||||
from_secret: PORTAINER_STACK_ID # the ID of your mailconfig stack
|
||||
commands:
|
||||
- >
|
||||
curl -s -X POST "$PORTAINER_URL/api/stacks/$STACK_ID/file?endpointId=$ENDPOINT_ID&method=string"
|
||||
-H "Authorization: Bearer $PORTAINER_API_KEY"
|
||||
-F "file=@docker-compose.yml"
|
||||
- name: Deploy Container
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: ttps://portainer.mifi.dev/api/stacks/webhooks/f7e63722-cafd-4970-8729-9f1936c6a070
|
||||
|
||||
- name: Send Deploy Status Notification
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
||||
"text": "[{{ repo.name }} - Build # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
"username":"DroneBot"
|
||||
}
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
volumes:
|
||||
- name: dockerconfig
|
||||
host:
|
||||
path: /volume1/docker/dockerconfig.json
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Production Deploy Pipeline
|
||||
|
||||
workspace:
|
||||
path: /drone/mail-autoconfig
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: Deploy to Production
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: https://portainer.mail.mifi.holdings/api/stacks/webhooks/WEBHOOK_ID_HERE
|
||||
|
||||
- name: Send Production Deploy Status
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
||||
"text": "[{{ repo.name }} - Build # {{ build.number }}] Production Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
"username":"DroneBot"
|
||||
}
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
depends_on:
|
||||
- Build and Deploy Pipeline
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- promote
|
||||
target:
|
||||
- production
|
||||
|
||||
Reference in New Issue
Block a user