Major Fix in Japanese translation. (#231) #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automatic Build on Commit | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
- '.github/**' | |
- '!.github/workflows/**' | |
jobs: | |
build: | |
name: Build CI | |
if: ${{ success() }} | |
runs-on: ubuntu-latest | |
env: | |
MODULE_APK_OUTPUT_PATH: 'module-app/build/outputs/apk' | |
DEMO_APK_OUTPUT_PATH: 'demo-app/build/outputs/apk' | |
APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }} | |
TG_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
TG_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
COMMIT_MESSAGE: |+ | |
New push to GitHub\! | |
``` | |
${{ github.event.head_commit.message }} | |
```by `${{ github.event.head_commit.author.name }}` | |
See commit detail [here](${{ github.event.head_commit.url }}) | |
COMMIT_URL: ${{ github.event.head_commit.url }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare GitHub Env | |
run: | | |
GITHUB_SHA=${{ github.sha }} | |
GITHUB_CI_COMMIT_ID=${GITHUB_SHA:0:7} | |
echo "GITHUB_CI_COMMIT_ID=$GITHUB_CI_COMMIT_ID" >> $GITHUB_ENV | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v1 | |
with: | |
cmake-version: '3.22.1' | |
- name: Prepare Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
java-package: jdk | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Cache Gradle Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
!~/.gradle/caches/build-cache-* | |
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }} | |
restore-keys: | | |
gradle-deps | |
- name: Cache Gradle Build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches/build-cache-* | |
key: gradle-builds-core-${{ github.sha }} | |
restore-keys: | | |
gradle-builds | |
- name: Build with Gradle | |
run: | | |
./gradlew :module-app:assembleDebug | |
./gradlew :module-app:assembleRelease | |
./gradlew :demo-app:assembleDebug | |
./gradlew :demo-app:assembleRelease | |
echo "MODULE_DEBUG_APK_PATH=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV | |
echo "MODULE_RELEASE_APK_PATH=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV | |
echo "DEMO_DEBUG_APK_PATH=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV | |
echo "DEMO_RELEASE_APK_PATH=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV | |
- name: Upload Artifacts (Module-Debug) | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ env.MODULE_DEBUG_APK_PATH }} | |
name: AppErrorsTracking-module-debug-${{ github.event.head_commit.id }} | |
- name: Upload Artifacts (Module-Release) | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ env.MODULE_RELEASE_APK_PATH }} | |
name: AppErrorsTracking-module-release-${{ github.event.head_commit.id }} | |
- name: Upload Artifacts (Demo-Debug) | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ env.DEMO_DEBUG_APK_PATH }} | |
name: AppErrorsTracking-demo-debug-${{ github.event.head_commit.id }} | |
- name: Upload Artifacts (Demo-Release) | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ env.DEMO_RELEASE_APK_PATH }} | |
name: AppErrorsTracking-demo-release-${{ github.event.head_commit.id }} | |
- name: Post Artifacts to Telegram | |
run: | | |
export module_debug=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/debug -name "*.apk") | |
export module_release=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/release -name "*.apk") | |
export demo_debug=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/debug -name "*.apk") | |
export demo_release=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/release -name "*.apk") | |
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'` | |
curl -v "https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMediaGroup?chat_id=${TG_CHAT_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fmodule_debug%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fmodule_release%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdemo_debug%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdemo_release%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22:${ESCAPED}%7D%5D" \ | |
-F module_debug="@$module_debug" \ | |
-F module_release="@$module_release" \ | |
-F demo_debug="@$demo_debug" \ | |
-F demo_release="@$demo_release" |