Skip to content

Commit 5a7e45f

Browse files
committed
ci: Update example.yml
1 parent 3ed4d5c commit 5a7e45f

File tree

2 files changed

+98
-54
lines changed

2 files changed

+98
-54
lines changed

.github/workflows/android-simple.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/example.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Build Example App
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- 'README.md'
8+
- 'docs/**'
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ macos-latest, ubuntu-latest, windows-latest ]
16+
include:
17+
- os: windows-latest
18+
platform: windows x64
19+
build-command: ./gradlew createReleaseDistributable
20+
artifact-path: example/build/compose/binaries/main-release/app/Miuix
21+
artifact-name: Miuix-windows-x64-exe
22+
- os: macos-latest
23+
platform: macos arm64
24+
build-command: ./gradlew packageDmgNativeReleaseMacosArm64
25+
artifact-path: example/build/compose/binaries/main/native-macosArm64-release-dmg
26+
artifact-name: Miuix-darwin-arm64-dmg
27+
- os: ubuntu-latest
28+
platform: linux x64
29+
platformEx: android aarch64
30+
build-command: ./gradlew createReleaseDistributable
31+
build-commandEx: ./gradlew assembleDebug && ./gradlew assembleRelease
32+
artifact-path: example/build/compose/binaries/main-release/app/Miuix
33+
artifact-pathEx: example/build/outputs/apk/release
34+
artifact-name: Miuix-linux-x64-bin
35+
artifact-nameEx: Miuix-android-aarch64-apk
36+
37+
steps:
38+
- name: Checkout sources
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Setup JDK
44+
uses: actions/setup-java@v4
45+
with:
46+
distribution: 'zulu'
47+
java-version: '21'
48+
49+
- name: Setup Gradle
50+
uses: gradle/actions/setup-gradle@v4
51+
52+
- name: Decode android signing key
53+
if: matrix.platformEx == 'android aarch64'
54+
run: echo ${{ secrets.SIGNING_KEY }} | base64 -d > keystore.jks
55+
56+
- name: Build ${{ matrix.platform }} platform
57+
run: ${{ matrix.build-command }}
58+
59+
- name: Build ${{ matrix.platformEx }} platform
60+
if: matrix.platformEx == 'android aarch64'
61+
run: ${{ matrix.build-commandEx }}
62+
env:
63+
KEYSTORE_PATH: "../keystore.jks"
64+
KEYSTORE_PASS: ${{ secrets.KEY_STORE_PASSWORD }}
65+
KEY_ALIAS: ${{ secrets.ALIAS }}
66+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
67+
68+
- name: Upload Miuix ${{ matrix.platform }} artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: ${{ matrix.artifact-name }}
72+
path: ${{ matrix.artifact-path }}
73+
74+
- name: Upload Miuix ${{ matrix.platformEx }} artifact
75+
if: matrix.platformEx == 'android aarch64'
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: ${{ matrix.artifact-nameEx }}
79+
path: ${{ matrix.artifact-pathEx }}
80+
81+
- name: Post to Telegram ci channel
82+
if: ${{ success() && matrix.platformEx == 'android aarch64' && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.ref_type != 'tag' }}
83+
env:
84+
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
85+
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
86+
COMMIT_MESSAGE: |+
87+
New CI from miuix\-kotlin\-multiplatform
88+
89+
```
90+
${{ github.event.head_commit.message }}
91+
```
92+
run: |
93+
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
94+
export RELEASE=$(find ./example/build/outputs/apk/release -name "*.apk")
95+
export DEBUG=$(find ./example/build/outputs/apk/debug -name "*.apk")
96+
ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'`
97+
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"
98+
fi

0 commit comments

Comments
 (0)