-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (54 loc) · 2.89 KB
/
xxc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Отправить сообщение в Telegram
on:
push:
branches:
- main
workflow_dispatch:
jobs:
send_telegram_message:
runs-on: windows-latest
steps:
- name: Получить версию
id: get_version
run: echo "::set-output name=VERSION::xxxx" # Версия всегда "xxxx"
- name: Отправить сообщение в Telegram
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
RELEASE_URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}
run: |
$telegramBotToken = '${{ secrets.TELEGRAM_BOT_TOKEN }}'
$telegramChatId = '${{ secrets.TELEGRAM_CHAT_ID }}'
$releaseUrl = 'https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}'
$message = 'Новый релиз: СтатичноеНазваниеРелиза`nВерсия: xxxx`nОписание: СтатичноеОписание`nSolution Name: СтатичноеНазваниеРешения`nСсылка на релиз: $releaseUrl'
$uri = 'https://api.telegram.org/bot' + $telegramBotToken + '/sendMessage'
$body = @{
chat_id = $telegramChatId
text = $message
}
$bodyJson = $body | ConvertTo-Json -Compress
Invoke-RestMethod -Uri $uri -Method Post -Body $bodyJson -ContentType 'application/json'
- name: Отправить сообщение в Telegram 2
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
RELEASE_URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}
run: |
$telegramBotToken = '${{ secrets.TELEGRAM_BOT_TOKEN }}'
$telegramChatId = '${{ secrets.TELEGRAM_CHAT_ID }}'
$releaseUrl = 'https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}'
$message = @"
<b>🎉 Новый релиз:</b> ${{ github.event.inputs.namevers }}
<b>📦 Версия:</b> ${{ steps.get_version.outputs.VERSION }}
<b>📝 Описание:</b> ${{ github.event.inputs.descr }}
<b>🔧 Solution Name:</b> ${{ env.Solution_Name }}
<b>🔗 Ссылка на релиз:</b> <a href='$releaseUrl'>$releaseUrl</a>
"@
$uri = 'https://api.telegram.org/bot' + $telegramBotToken + '/sendMessage'
$body = @{
chat_id = $telegramChatId
text = $message
parse_mode = 'HTML'
}
$bodyJson = $body | ConvertTo-Json -Compress
Invoke-RestMethod -Uri $uri -Method Post -Body $bodyJson -ContentType 'application/json'