From 3f559b37a64d3bb8951ea43344b1fde423f83917 Mon Sep 17 00:00:00 2001 From: Moh Dzulfikri Maulana <106526316+Dzuuul@users.noreply.github.com> Date: Tue, 10 Mar 2026 13:58:54 +0700 Subject: [PATCH] feat: Add dedicated Telegram notification step for build status and remove inline curl notification from deploy step. --- .woodpecker.yml | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1605049..b725b77 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -25,26 +25,44 @@ steps: port: 22 key: from_secret: ssh_key - # Pastikan penamaan di sini konsisten - envs: [ gitea_user, gitea_token, telegram_token, telegram_chat_id ] + envs: [ gitea_user, gitea_token ] gitea_user: from_secret: gitea_user gitea_token: from_secret: gitea_token - telegram_token: - from_secret: telegram_token - telegram_chat_id: - from_secret: telegram_chat_id script: - cd ~/projects/fikri-fullstack-portfolio - - echo $GITEA_TOKEN | docker login git.exavolt.web.id -u $GITEA_USER --password-stdin + - echo $gitea_token | docker login git.exavolt.web.id -u $gitea_user --password-stdin - docker compose pull - docker compose up -d --remove-orphans - docker image prune -f - - echo "Cek Token: ${telegram_token:0:5}... - - > - curl -s -X POST "https://api.telegram.org/bot${telegram_token}/sendMessage" - -d "chat_id=${telegram_chat_id}" - -d "message_thread_id=8" - -d "parse_mode=HTML" - -d "text=🚀 Deployment Success!%0AProject: portfolio%0AStatus: Finished" \ No newline at end of file + when: + branch: master + event: push + + # 3. Notification (Jalan saat sukses maupun gagal) + notify-telegram: + image: appleboy/drone-telegram + settings: + token: + from_secret: telegram_token + to: + from_secret: telegram_chat_id + message_thread_id: 8 + format: html + message: | + {{#success build.status}} + ✅ Deployment SUCCESS! + {{else}} + ❌ Deployment FAILED! + {{/success}} + + 📦 Project: {{ repo.name }} + 🌿 Branch: {{ build.branch }} + 📝 Commit: {{ commit.message }} + + 🔗 Lihat Detail Log + when: + branch: master + event: push + status: [ success, failure ] # Kunci agar notifikasi tetap terkirim saat error \ No newline at end of file