mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Prepare changelog & automate the publishing of update announcements
This commit is contained in:
5
.github/workflows/build_debug_apk.yml
vendored
5
.github/workflows/build_debug_apk.yml
vendored
@@ -78,11 +78,12 @@ jobs:
|
||||
name: Debug APK
|
||||
path: artifacts/debug-apk
|
||||
- name: Send notifications
|
||||
run: python send_notifications.py
|
||||
run: python ci.py
|
||||
env:
|
||||
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
|
||||
TELEGRAM_CI_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }}
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }}
|
||||
TELEGRAM_CI_CHANNEL_ID: ${{ secrets.TELEGRAM_CI_CHANNEL_ID }}
|
||||
TELEGRAM_TEAM_GROUP_ID: ${{ secrets.NOTIFY_CHANNEL_ID }}
|
||||
ARTIFACT_DIRECTORY: artifacts/debug-apk
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
ACTION: internal_notifications
|
||||
|
||||
7
.github/workflows/build_release_apk.yml
vendored
7
.github/workflows/build_release_apk.yml
vendored
@@ -75,11 +75,12 @@ jobs:
|
||||
name: Release APK
|
||||
path: artifacts/release-apk
|
||||
- name: Send notifications
|
||||
run: python send_notifications.py
|
||||
run: python ci.py
|
||||
env:
|
||||
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
|
||||
TELEGRAM_CI_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }}
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }}
|
||||
TELEGRAM_CI_CHANNEL_ID: ${{ secrets.TELEGRAM_CI_CHANNEL_ID }}
|
||||
TELEGRAM_TEAM_GROUP_ID: ${{ secrets.NOTIFY_CHANNEL_ID }}
|
||||
ARTIFACT_DIRECTORY: artifacts/release-apk
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
ACTION: internal_notifications
|
||||
|
||||
100
.github/workflows/release_update.yml
vendored
Normal file
100
.github/workflows/release_update.yml
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
name: Release update
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
artifactName:
|
||||
description: Artifact name
|
||||
type: string
|
||||
required: true
|
||||
tagName:
|
||||
description: Tag name
|
||||
type: string
|
||||
required: true
|
||||
prerelease:
|
||||
description: Prerelease
|
||||
type: boolean
|
||||
required: true
|
||||
jobs:
|
||||
build-release-apk:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Restore Gradle cache
|
||||
uses: actions/cache@v2.1.4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: ${{ runner.os }}-gradle-
|
||||
- name: Set up Java 11
|
||||
uses: actions/setup-java@v1.4.3
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Grant execution permission to Gradle Wrapper
|
||||
run: chmod +x gradlew
|
||||
- name: Build release APK
|
||||
run: ./gradlew assembleLawnWithQuickstepRelease
|
||||
- name: Sign release APK
|
||||
uses: r0adkll/sign-android-release@v1
|
||||
id: sign-release-apk
|
||||
with:
|
||||
releaseDirectory: build/outputs/apk/lawnWithQuickstep/release
|
||||
signingKeyBase64: ${{ secrets.KEYSTORE }}
|
||||
alias: ${{ secrets.KEY_ALIAS }}
|
||||
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||
- name: Rename artifact
|
||||
continue-on-error: true
|
||||
run: mv "${{ steps.sign-release-apk.outputs.signedReleaseFile }}" "${{ github.event.inputs.artifactName }}"
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Release APK
|
||||
path: ${{ github.event.inputs.artifactName }}
|
||||
publish-github-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-release-apk
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: Release APK
|
||||
path: artifacts/release-apk
|
||||
- name: Publish GitHub release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.tagName }}
|
||||
prerelease: ${{ github.events.inputs.prerelease }}
|
||||
draft: true
|
||||
body_path: ${{ github.workspace }}/GITHUB_CHANGELOG.md
|
||||
files: artifacts/release-apk${{ github.event.inputs.artifactName }}
|
||||
publish-telegram-update-post:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-release-apk
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: Release APK
|
||||
path: artifacts/release-apk
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: Install Python packages
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install requests
|
||||
- name: Publish Telegram update post
|
||||
run: python publish_telegram_update_post.py
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }}
|
||||
ARTIFACT_DIRECTORY: artifacts/release-apk
|
||||
TELEGRAM_NEWS_CHANNEL_ID: ${{ secrets.TELEGRAM_NEWS_CHANNEL_ID }}
|
||||
ACTION: update_announcement
|
||||
11
GITHUB_CHANGELOG.md
Normal file
11
GITHUB_CHANGELOG.md
Normal file
@@ -0,0 +1,11 @@
|
||||
Lawnchair 12.1 is here! This release is based on Launcher3 from Android 12.1 and works with
|
||||
QuickSwitch on Android 12.1. In addition, it includes the following new features:
|
||||
|
||||
- a new At a Glance widget
|
||||
- the ability to change the search provider for the Dock search bar (thanks to @evowizz)
|
||||
- multiple new shapes for Adaptive Icons (thanks to @yasandev and @DariaHamrahPaytakht)
|
||||
- an option to display the notification count in Notification Dots (thanks to @yasandev and @DariaHamrahPaytakht)
|
||||
- the ability to add custom fonts
|
||||
- if Lawnchair is connected to QuickSwitch, an option to make the Recents background translucent
|
||||
|
||||
Also included in this version are bug fixes and other improvements. Thanks go to @arter97, @npv12, @erfanoabdi, and @SuperDragonXD for their contributions.
|
||||
11
TELEGRAM_CHANGELOG.txt
Normal file
11
TELEGRAM_CHANGELOG.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Lawnchair 12.1 is here! This release is based on Launcher3 from Android 12.1 and works with
|
||||
QuickSwitch on Android 12.1. In addition, it includes the following new features:
|
||||
|
||||
• a new At a Glance widget
|
||||
• the ability to change the search provider for the Dock search bar (thanks to <a href="https://github.com/evowizz">Dylan Roussel</a>)
|
||||
• multiple new shapes for Adaptive Icons (thanks to <a href="https://github.com/yasandev">@yasandev</a> and <a href="https://github.com/DariaHamrahPaytakht">Daria Hamrah Paytakht</a>)
|
||||
• an option to display the notification count in Notification Dots (thanks to <a href="https://github.com/yasandev">@yasandev</a> and <a href="https://github.com/DariaHamrahPaytakht">Daria Hamrah Paytakht</a>)
|
||||
• the ability to add custom fonts
|
||||
• if Lawnchair is connected to QuickSwitch, an option to make the Recents background translucent
|
||||
|
||||
Also included in this version are bug fixes and other improvements. Thanks go to <a href="https://github.com/arter97">Juhyung Park</a>, <a href="https://github.com/npv12">Pranav Santhosh</a>, <a href="https://github.com/erfanoabdi">Erfan Abdi</a>, and <a href="https://github.com/SuperDragonXD">@SuperDragonXD</a> for their contributions.
|
||||
73
ci.py
Normal file
73
ci.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import git
|
||||
import html
|
||||
import os
|
||||
import requests
|
||||
import re
|
||||
|
||||
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_bot_token = os.getenv("TELEGRAM_BOT_TOKEN")
|
||||
telegram_ci_channel_id = os.getenv("TELEGRAM_CI_CHANNEL_ID")
|
||||
telegram_team_group_id = os.getenv("TELEGRAM_TEAM_GROUP_ID")
|
||||
telegram_news_channel_id = os.getenv("TELEGRAM_NEWS_CHANNEL_ID")
|
||||
|
||||
artifact_directory = os.getenv("ARTIFACT_DIRECTORY")
|
||||
action = os.getenv("ACTION")
|
||||
|
||||
def send_message_to_telegram_chat(chat_id, message, silent):
|
||||
requests.post(
|
||||
url = f"https://api.telegram.org/bot{telegram_bot_token}/sendMessage",
|
||||
data = {
|
||||
"chat_id": chat_id,
|
||||
"parse_mode": "HTML",
|
||||
"text": message,
|
||||
"disable_web_page_preview": "true",
|
||||
"disable_notification": str(silent)
|
||||
}
|
||||
)
|
||||
|
||||
def send_document_to_telegram_chat(chat_id, document):
|
||||
requests.post(
|
||||
url = f"https://api.telegram.org/bot{telegram_bot_token}/sendDocument",
|
||||
data = { "chat_id": chat_id },
|
||||
files = { "document": document }
|
||||
)
|
||||
|
||||
def send_artifact_to_telegram_chat(chat_id):
|
||||
with open(f"{artifact_directory}/{os.listdir(artifact_directory)[0]}", "rb") as artifact:
|
||||
send_document_to_telegram_chat(chat_id=chat_id, document=artifact)
|
||||
|
||||
def send_internal_notifications():
|
||||
repository = git.Repo(".")
|
||||
commit_range = f"{github_event_before}...{github_sha}"
|
||||
commits = list(repository.iter_commits(commit_range))
|
||||
|
||||
overview_link = f"https://github.com/{github_repository}/compare/{commit_range}"
|
||||
overview_link_tag = f"""<a href="{overview_link}">{len(commits)} new commit{"s" if len(commits) > 1 else ""}</a>"""
|
||||
message = f"""<b>🔨 {overview_link_tag} to <code>lawnchair:{github_ref}</code>:</b>\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"""<a href="{commit_link}">{repository.git.rev_parse(commit.hexsha, short=7)}</a>"""
|
||||
encoded_message = html.escape(commit_message)
|
||||
message += f"\n• {commit_link_tag}: {encoded_message}"
|
||||
|
||||
send_message_to_telegram_chat(chat_id=telegram_ci_channel_id, message=message, silent=False)
|
||||
send_message_to_telegram_chat(chat_id=telegram_team_group_id, message=message, silent=True)
|
||||
send_artifact_to_telegram_chat(chat_id=telegram_ci_channel_id)
|
||||
|
||||
def send_update_announcement():
|
||||
send_artifact_to_telegram_chat(chat_id=telegram_news_channel_id)
|
||||
|
||||
with open("TELEGRAM_CHANGELOG.txt") as telegram_changelog:
|
||||
send_message_to_telegram_chat(chat_id=telegram_news_channel_id, message=telegram_changelog.read(), silent=False)
|
||||
|
||||
match action:
|
||||
case "internal_notifications":
|
||||
send_internal_notifications()
|
||||
case "update_announcement":
|
||||
send_update_announcement()
|
||||
@@ -1,72 +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')
|
||||
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(
|
||||
url = 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(
|
||||
url = 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(
|
||||
url = 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'''<a href="{overview_link}">{len(commits)} new commit{'s' if len(commits) > 1 else ''}</a>'''
|
||||
message = f'''<b>🔨 {overview_link_tag} to <code>lawnchair:{github_ref}</code>:</b>\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'<a href="{commit_link}">{repository.git.rev_parse(commit.hexsha, short=7)}</a>'
|
||||
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(f'{artifact_directory}/{os.listdir(artifact_directory)[0]}', 'rb') as apk:
|
||||
send_document_to_ci_channel(document=apk)
|
||||
Reference in New Issue
Block a user