feat: Add dedicated Telegram notification step for build status and remove inline curl notification from deploy step.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -25,26 +25,44 @@ steps:
|
|||||||
port: 22
|
port: 22
|
||||||
key:
|
key:
|
||||||
from_secret: ssh_key
|
from_secret: ssh_key
|
||||||
# Pastikan penamaan di sini konsisten
|
envs: [ gitea_user, gitea_token ]
|
||||||
envs: [ gitea_user, gitea_token, telegram_token, telegram_chat_id ]
|
|
||||||
gitea_user:
|
gitea_user:
|
||||||
from_secret: gitea_user
|
from_secret: gitea_user
|
||||||
gitea_token:
|
gitea_token:
|
||||||
from_secret: gitea_token
|
from_secret: gitea_token
|
||||||
telegram_token:
|
|
||||||
from_secret: telegram_token
|
|
||||||
telegram_chat_id:
|
|
||||||
from_secret: telegram_chat_id
|
|
||||||
script:
|
script:
|
||||||
- cd ~/projects/fikri-fullstack-portfolio
|
- 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 pull
|
||||||
- docker compose up -d --remove-orphans
|
- docker compose up -d --remove-orphans
|
||||||
- docker image prune -f
|
- docker image prune -f
|
||||||
- echo "Cek Token: ${telegram_token:0:5}...
|
when:
|
||||||
- >
|
branch: master
|
||||||
curl -s -X POST "https://api.telegram.org/bot${telegram_token}/sendMessage"
|
event: push
|
||||||
-d "chat_id=${telegram_chat_id}"
|
|
||||||
-d "message_thread_id=8"
|
# 3. Notification (Jalan saat sukses maupun gagal)
|
||||||
-d "parse_mode=HTML"
|
notify-telegram:
|
||||||
-d "text=🚀 <b>Deployment Success!</b>%0A<b>Project:</b> portfolio%0A<b>Status:</b> Finished"
|
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}}
|
||||||
|
✅ <b>Deployment SUCCESS!</b>
|
||||||
|
{{else}}
|
||||||
|
❌ <b>Deployment FAILED!</b>
|
||||||
|
{{/success}}
|
||||||
|
|
||||||
|
<b>📦 Project:</b> <code>{{ repo.name }}</code>
|
||||||
|
<b>🌿 Branch:</b> <code>{{ build.branch }}</code>
|
||||||
|
<b>📝 Commit:</b> <i>{{ commit.message }}</i>
|
||||||
|
|
||||||
|
🔗 <a href="{{ build.link }}">Lihat Detail Log</a>
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: push
|
||||||
|
status: [ success, failure ] # Kunci agar notifikasi tetap terkirim saat error
|
||||||
Reference in New Issue
Block a user