From c87e669e8a40fe294f6420e11d48b96c7cdd089c Mon Sep 17 00:00:00 2001 From: mifi Date: Wed, 23 Jul 2025 22:42:11 -0300 Subject: [PATCH] Update drone.yml --- .drone.yml | 111 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 86 insertions(+), 25 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9f22e92..3dabd2b 100644 --- a/.drone.yml +++ b/.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 - image: plugins/docker - settings: - repo: registry.your-gitea.com/your-org/mail-autoconfig - tags: latest - username: - from_secret: GITEA_USERNAME - password: - from_secret: GITEA_TOKEN +- name: Build and Publish Docker Image + image: plugins/docker + settings: + auto_tag: true + repo: git.mifi.dev/mifi/mail-autoconfig + registry: git.mifi.dev + username: + password: + 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