diff --git a/.github/workflows/build_debug_apk.yml b/.github/workflows/build_debug_apk.yml
index 4c59f71d3f..0642bb05fe 100644
--- a/.github/workflows/build_debug_apk.yml
+++ b/.github/workflows/build_debug_apk.yml
@@ -4,7 +4,11 @@ on:
workflow_dispatch:
push:
branches:
- - 11-dev
+ - '*'
+ - '*/*'
+ - '**'
+ - '!11-dev-localization'
+ - '!11-alpha'
jobs:
build-debug-apk:
@@ -45,26 +49,9 @@ jobs:
with:
name: Debug APK
path: ${{ steps.sign-debug-apk.outputs.signedReleaseFile }}
- send-apk:
+ send-notifications:
runs-on: ubuntu-latest
needs: build-debug-apk
- steps:
- - name: Download artifact
- uses: actions/download-artifact@v2
- with:
- name: Debug APK
- path: artifacts/debug-apk
- - uses: technote-space/workflow-conclusion-action@v2.1.5
- - name: Send APK
- uses: appleboy/telegram-action@v0.1.0
- with:
- to: ${{ secrets.TELEGRAM_CI_CHANNEL_ID }}
- token: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }}
- document: artifacts/debug-apk/**.apk
- message: ''
- send-changelog:
- runs-on: ubuntu-latest
- needs: send-apk
steps:
- name: Check out repository
uses: actions/checkout@v2.3.4
@@ -81,10 +68,18 @@ jobs:
packages: |
gitpython
requests
- - name: Send changelog
- run: python send_changelog.py
+ fnmatch
+ - name: Download artifact
+ uses: actions/download-artifact@v2
+ with:
+ name: Debug APK
+ path: artifacts/debug-apk
+ - name: Send notifications
+ run: python send_notifications.py
env:
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
TELEGRAM_CI_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }}
TELEGRAM_CI_CHANNEL_ID: ${{ secrets.TELEGRAM_CI_CHANNEL_ID }}
- BRANCH: 11-dev
+ TELEGAM_TEAM_GROUP_ID: ${{ secrets.NOTIFY_CHANNEL_ID }}
+ ARTIFACT_DIRECTORY: artifacts/debug-apk
+ GITHUB_REF: ${{ github.ref }}
diff --git a/send_changelog.py b/send_changelog.py
deleted file mode 100644
index 369ab2705f..0000000000
--- a/send_changelog.py
+++ /dev/null
@@ -1,37 +0,0 @@
-import git
-import html
-import os
-import requests
-
-github_event_before = os.getenv('GITHUB_EVENT_BEFORE')
-github_sha = os.getenv('GITHUB_SHA')
-github_repository = os.getenv('GITHUB_REPOSITORY')
-telegram_ci_bot_token = os.getenv('TELEGRAM_CI_BOT_TOKEN')
-telegram_ci_channel_id = os.getenv('TELEGRAM_CI_CHANNEL_ID')
-branch = os.getenv('BRANCH')
-
-repository = git.Repo('.')
-commits_range = f'{github_event_before}...{github_sha}'
-commits = list(repository.iter_commits(commits_range))
-
-overview_link = f'https://github.com/{github_repository}/compare/{commits_range}'
-overview_link_tag = f'''{len(commits)} new commit{'s' if len(commits) > 1 else ''}'''
-message = f'''🔨 {overview_link_tag} to lawnchair:{branch}:\n'''
-
-for commit in reversed(commits):
- commit_message = commit.message.split('\n')[0]
- commit_link = f'https://github.com/{github_repository}/commit/{commit.hexsha}'
- commit_link_tag = f'{repository.git.rev_parse(commit.hexsha, short=7)}'
- encoded_message = html.escape(commit_message)
- message += f'\n• {commit_link_tag}: {encoded_message}'
-
-data = {
- 'chat_id': telegram_ci_channel_id,
- 'parse_mode': 'HTML',
- 'text': message,
- 'disable_web_page_preview': 'true',
- 'disable_notification': 'true'
-}
-
-r = requests.post(
- f'https://api.telegram.org/bot{telegram_ci_bot_token}/sendMessage', data)
diff --git a/send_notifications.py b/send_notifications.py
new file mode 100644
index 0000000000..003986918b
--- /dev/null
+++ b/send_notifications.py
@@ -0,0 +1,72 @@
+import git
+import html
+import os
+import requests
+
+github_event_before = os.getenv('GITHUB_EVENT_BEFORE')
+github_sha = os.getenv('GITHUB_SHA')
+github_repository = os.getenv('GITHUB_REPOSITORY')
+github_ref = os.getenv('GITHUB_REF')
+telegram_ci_bot_token = os.getenv('TELEGRAM_CI_BOT_TOKEN')
+telegram_ci_channel_id = os.getenv('TELEGRAM_CI_CHANNEL_ID')
+telegram_team_group_id = os.getenv('TELEGRAM_TEAM_GROUP_ID')
+artifact_directory = os.getenv('ARTIFACT_DIRECTORY')
+
+def send_message_to_ci_channel(message):
+ data = {
+ 'chat_id': telegram_ci_channel_id,
+ 'parse_mode': 'HTML',
+ 'text': message,
+ 'disable_web_page_preview': 'true'
+ }
+ requests.post(
+ post = f'https://api.telegram.org/bot{telegram_ci_bot_token}/sendMessage',
+ data = data
+ )
+
+def send_document_to_ci_channel(document):
+ data = {
+ 'chat_id': telegram_ci_channel_id,
+ }
+ files = {
+ 'document': document
+ }
+ requests.post(
+ post = f'https://api.telegram.org/bot{telegram_ci_bot_token}/sendDocument',
+ data = data,
+ files = files
+ )
+
+def send_silent_message_to_team_group(message):
+ data = {
+ 'chat_id': telegram_team_group_id,
+ 'parse_mode': 'HTML',
+ 'text': message,
+ 'disable_web_page_preview': 'true',
+ 'disable_notification': 'true'
+ }
+ requests.post(
+ post = f'https://api.telegram.org/bot{telegram_ci_bot_token}/sendMessage',
+ data = data
+ )
+
+repository = git.Repo('.')
+commits_range = f'{github_event_before}...{github_sha}'
+commits = list(repository.iter_commits(commits_range))
+
+overview_link = f'https://github.com/{github_repository}/compare/{commits_range}'
+overview_link_tag = f'''{len(commits)} new commit{'s' if len(commits) > 1 else ''}'''
+message = f'''🔨 {overview_link_tag} to lawnchair:{github_ref}:\n'''
+
+for commit in reversed(commits):
+ commit_message = commit.message.split('\n')[0]
+ commit_link = f'https://github.com/{github_repository}/commit/{commit.hexsha}'
+ commit_link_tag = f'{repository.git.rev_parse(commit.hexsha, short=7)}'
+ encoded_message = html.escape(commit_message)
+ message += f'\n• {commit_link_tag}: {encoded_message}'
+
+send_message_to_ci_channel(message=message)
+send_silent_message_to_team_group(message=message)
+
+with open(os.listdir(artifact_directory)[0], 'rb') as apk:
+ send_document_to_ci_channel(document=apk)
\ No newline at end of file