2.3.4 #100
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: Android CI | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
run: | |
description: "" | |
required: true | |
default: run | |
type: choice | |
options: | |
- run | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
!~/.gradle/caches/build-cache-* | |
key: gradle-deps-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: gradle-deps | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Clone UI | |
run: | | |
cd blockmiui | |
git submodule init | |
git submodule update | |
- name: Clone TOAST | |
run: | | |
cd xtoast | |
git submodule init | |
git submodule update | |
- name: Build with Gradle | |
run: | | |
bash ./gradlew assembleRelease | |
bash ./gradlew assembleDebug | |
- name: Sign Release APK | |
if: success() | |
id: sign_release | |
uses: r0adkll/[email protected] | |
with: | |
releaseDirectory: ./app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: xiao_wine | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
- name: Sign Debug APK | |
if: success() | |
id: sign_debug | |
uses: r0adkll/[email protected] | |
with: | |
releaseDirectory: ./app/build/outputs/apk/debug | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: xiao_wine | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
- name: Upload Release APK | |
uses: actions/upload-artifact@v2 | |
with: | |
name: InkHome_release | |
path: ${{ steps.sign_release.outputs.signedReleaseFile }} | |
- name: Upload Debug APK | |
uses: actions/upload-artifact@v2 | |
with: | |
name: InkHome_debug | |
path: ${{ steps.sign_debug.outputs.signedReleaseFile }} | |
- name: Upload Release Mapping | |
uses: actions/upload-artifact@v2 | |
with: | |
name: InkHone_release_mapping | |
path: ./app/build/outputs/mapping/release/mapping.txt | |
- name: Post to channel | |
if: contains(github.event.head_commit.message, '[skip post]') == false | |
env: | |
CHANNEL_ID: ${{ secrets.CHANNEL_ID }} | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
RELEASE: ${{ steps.sign_release.outputs.signedReleaseFile }} | |
DEBUG: ${{ steps.sign_debug.outputs.signedReleaseFile }} | |
COMMIT_MESSAGE: |+ | |
Github CI | |
``` | |
${{ github.event.head_commit.message }} | |
``` | |
run: | | |
ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'` | |
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Frelease%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdebug%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22%3A${ESCAPED}%7D%5D" -F release="@$RELEASE" -F debug="@$DEBUG" |