42 lines
1.4 KiB
YAML
42 lines
1.4 KiB
YAML
name: 🤖 Test telegram deploy bot
|
|
run-name: '🤖 Test telegram deploy bot: ${{ gitea.ref_name }} by @${{ gitea.actor }}'
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
send_test_message:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 📂 Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: ⚙️ Configure ssh client
|
|
uses: ./.gitea/actions/configure-ssh-client
|
|
with:
|
|
ssh_host: ${{ secrets.SSH_HOST }}
|
|
|
|
- name: ✍️ Prepare message
|
|
id: prepare_message
|
|
uses: ./.gitea/actions/telegram-message-escape
|
|
with:
|
|
message: 💬 Test message
|
|
|
|
- name: 💬 Send message
|
|
env:
|
|
SSHPASS: ${{ secrets.SSH_PASSWORD }}
|
|
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_DEPLOY_BOT_TOKEN }}
|
|
TELEGRAM_CHAT: ${{ secrets.TELEGRAM_DEPLOY_CHAT_ID }}
|
|
PROXY_URL: ${{ secrets.PROXY_URL }}
|
|
MESSAGE: ${{ steps.prepare_message.outputs.escaped_message }}
|
|
run: |
|
|
sshpass -e ssh -p 22 "$SSH_USERNAME@$SSH_HOST" bash -s << 'EOT'
|
|
set -e
|
|
|
|
curl -s --connect-timeout 10 -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" \
|
|
--proxy "${PROXY_URL}" \
|
|
-d "chat_id=${TELEGRAM_CHAT}" \
|
|
-d "parse_mode=MarkdownV2" \
|
|
-d "text=${MESSAGE}"
|
|
EOT |