Files
deploy-notify/action.yml
2025-12-30 14:51:23 +07:00

88 lines
2.5 KiB
YAML

name: "Deploy Notification"
description: "Notify deployment result via ntfy, Gmail SMTP, and Telegram"
inputs:
status:
description: 'Deployment status (e.g., success, failure)'
required: true
title:
description: 'Notification title'
required: true
message:
description: 'Notification message body'
required: true
# Configuration
ntfy_url:
description: 'Ntfy server URL'
required: false
default: 'https://ntfy.hcmc.online'
ntfy_topic:
description: 'Ntfy topic'
required: false
default: 'act_runner_deployment'
ntfy_username:
description: 'Ntfy Basic Auth Username'
required: false
ntfy_password:
description: 'Ntfy Basic Auth Password'
required: false
server_url:
description: 'Git server BASE URL (e.g., https://git.hcmc.online)'
required: false
default: 'https://git.hcmc.online'
# Email Configuration
gmail_user:
description: 'Gmail username (sender)'
required: false
gmail_to:
description: 'Email recipient'
required: false
gmail_password:
description: 'Gmail App Password'
required: false
# Telegram Configuration
telegram_bot_token:
description: 'Telegram Bot Token'
required: false
telegram_chat_id:
description: 'Telegram Chat ID'
required: false
runs:
using: "composite"
steps:
- name: Send notification
shell: bash
env:
# Core
STATUS: ${{ inputs.status }}
TITLE: ${{ inputs.title }}
MESSAGE: ${{ inputs.message }}
# Ntfy
NTFY_URL: ${{ inputs.ntfy_url || 'https://ntfy.hcmc.online' }}
NTFY_TOPIC: ${{ inputs.ntfy_topic || 'act_runner_deployment' }}
NTFY_USERNAME: ${{ inputs.ntfy_username || env.NTFY_AUTH_USER }}
NTFY_PASSWORD: ${{ inputs.ntfy_password || env.NTFY_AUTH_PASS }}
# Git
GIT_URL: ${{ inputs.server_url || 'https://git.hcmc.online' }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
# Gmail
GMAIL_USER: ${{ inputs.gmail_user || env.GMAIL_USER }}
GMAIL_TO: ${{ inputs.gmail_to || 'tienngodev@proton.me' }}
GMAIL_PASS: ${{ inputs.gmail_password || env.GMAIL_PASSWORD }}
# Telegram
TELEGRAM_BOT_TOKEN: ${{ inputs.telegram_bot_token || env.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ inputs.telegram_chat_id || env.TELEGRAM_BOT_CHATID }}
run: |
bash ${{ github.action_path }}/notify.sh