-
Notifications
You must be signed in to change notification settings - Fork 6
144 lines (128 loc) · 4.56 KB
/
Copy pathbuild-dev-client.yml
File metadata and controls
144 lines (128 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build Dev Client APK
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
paths-ignore:
- "README.md"
- "wiki/**"
- "public/**"
- ".vscode"
- ".idea"
pull_request:
branches:
- master
- main
paths-ignore:
- "README.md"
- "wiki/**"
- "public/**"
- ".vscode"
- ".idea"
jobs:
build-dev-client:
name: Build dev-client + Detox test APK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v6
with:
node-version: 22.x
cache: pnpm
- name: Set Up JDK
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "17"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10.2
- name: Set Build Tools Version
run: |
echo "BUILD_TOOLS_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | sort -V | tail -n 1)" >> $GITHUB_ENV
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v5
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Type check, lint, and unit test
run: |
pnpm run check
pnpm run lint
pnpm run test:unit
- uses: actions/cache@v5
name: Cache Gradle Wrapper and Dependencies
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build tw plugins & scripts
run: |
pnpm run build:plugin
pnpm run build:tw-assets
pnpm run build:wiki-template
- name: Install expo-dev-client
run: pnpm install expo-dev-client -w
# Modify app.json for dev-client to use different package name and app name
- name: Modify app.json for dev-client
run: |
node -e "
const fs = require('fs');
const appJson = JSON.parse(fs.readFileSync('app.json', 'utf8'));
appJson.expo.name = 'TidGi Test';
appJson.expo.android.package = 'ren.onetwo.tidgi.mobile.test';
appJson.expo.ios.bundleIdentifier = 'ren.onetwo.tidgi.mobile.test';
fs.writeFileSync('app.json', JSON.stringify(appJson, null, 2));
"
- name: Expo prebuild (dev-client)
run: pnpm exec expo prebuild -p android --clean
- name: Save Android prebuild diagnostics (dev-client)
run: |
mkdir -p /tmp/apk-artifacts
cp android/app/src/main/AndroidManifest.xml /tmp/apk-artifacts/AndroidManifest-dev-client.xml
cp android/app/build.gradle /tmp/apk-artifacts/app-build.gradle
grep -nE "coreLibraryDesugaring|desugar_jdk_libs|compileOptions" android/app/build.gradle || true
- name: Build dev-client APK (debug + androidTest)
run: |
cd android
./gradlew assembleDebug :app:assembleAndroidTest --no-daemon --warning-mode all -DtestBuildType=debug
- name: Collect APKs into flat staging dir
run: |
mkdir -p /tmp/apk-artifacts
mv android/app/build/outputs/apk/debug/app-debug.apk /tmp/apk-artifacts/app-release-dev-client.apk
mv android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk /tmp/apk-artifacts/app-debug-androidTest.apk
- name: Upload dev-client APK artifact
uses: actions/upload-artifact@v5
with:
name: dev-client-apks-${{ github.run_number }}-${{ github.sha }}
path: |
/tmp/apk-artifacts/app-release-dev-client.apk
/tmp/apk-artifacts/app-debug-androidTest.apk
if-no-files-found: warn
- name: Create Release (dev-client APKs)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: false
files: |
/tmp/apk-artifacts/app-release-dev-client.apk
/tmp/apk-artifacts/app-debug-androidTest.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}