Skip to content

Commit 393e7bf

Browse files
committed
1、使用productFlavor区分测试版和正式版的包名和应用名
2、apk名称增加时间戳 3、应用versionname追加short commit id 4、上传经加密的密钥以及配置文件 Change-Id: I454c9fc1033dd3c0a030125e9750d34a22830b9c
1 parent 7b37775 commit 393e7bf

10 files changed

+71
-14
lines changed

.github/app-config.json.asc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-----BEGIN PGP MESSAGE-----
2+
3+
jA0EBwMCcddlN4+c7mrs0sANAU7MDJWpUv5zKTp4Yuac7gaXh95BWaod5kiVY3Qz
4+
HfK12u8HcXevdDGloFRV+lXIsY1G979/ckIVrXCYvVvVWL1LudgaXQRpIUOX1T8F
5+
B91/i/Y7Xqy2R5LNl7I37dzGbFYLhcFkqAx2I6lWEZOkUUEIJ6hx3JfF16+WUYyW
6+
T5i2Q70YR4rEp5FUSLLWcCgv0kofvoMOz6zkws2L+sZhYLVRD/nqpK9fenidsoqx
7+
+h+KQaTQHSbqwb6o/9XGS2st3N2YqenHEQLTzp16mw==
8+
=41gE
9+
-----END PGP MESSAGE-----

.github/app/google-services.json.asc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-----BEGIN PGP MESSAGE-----
2+
3+
jA0EBwMCluhfHKwgO/Ps0ukB6aQbVz9uxEbqhS12eNCGBWtSw3wzMJJIRMf4sThb
4+
MkX0e8yC5pV1C6zfn+xaqWEv1WU7UqLCjzmJ9Rof6A64ZNruc97Ph3sLMThSRdM8
5+
roNpsHTxOtDfTri454By35bVIUtrzQjbiqNwWaEbF5uykI0F/U5XA/k/EASs9IcY
6+
8KwewSealuQaeDCHH9WALoBJTFRY5aIbX/6EYI+Afipc7nkd4EVhCZFnynnN4YqL
7+
A1I6/Hj2ctZJxNW1mF92IJY8T7lHFM7pncDK0l7WmO8r5/BWjFwnDDlg9kuUJQkI
8+
F8T1KV+F4rYqRRsaBFt89cbkGVMZdewom2gAKBRvFjEgQclKU+ns1vofeXCJupk2
9+
45FkgJoxwtNZ/VgFT66YfxuWo86NenzwxTRBaEf52gCYozErViiBX7un9fxTWTyJ
10+
gYF2bv1Hhm4Wgo8dIAJ5wfB3PxqotqGrC4fPHp2/rwJOYGcvNlaiG1D42XXXqwgf
11+
wiYwbZrV6lJkrGm26u5/s3OFWdBDw7ySjnfe8vNxkyY5l4kh4Fmpsm1vLsXTre8T
12+
ecrwvcISXxDNeeGx6vOpVArnhDAiWqXucg/XYcfm34srDXIDZI9VMvoJJLudX2NV
13+
cGLyDFOnYnU5pATvcmWenKiVFAxt6V/nXmDLB0ovmyfCu7534Vep0/MBFEgg7GTc
14+
MHZKguSmRRY9GVRd+mx8AQmCBUXD/FUgYt3AM8T0UjZODiy2z+lKQdAeq7PaINFI
15+
5nbIjlrjV1Bi5hFMVGEnZMPVoqYlevAmJ+kQjDprejwBmZcBZo9Owk+AZKccvO+A
16+
mevTd533vA50JaU3rfduFO1tUTDhMsc7
17+
=uj+6
18+
-----END PGP MESSAGE-----

.github/workflows/debug.yml renamed to .github/workflows/opensource.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ jobs:
2525
- name: Build with Gradle
2626
run: ./gradlew build
2727
- name: Package apk and aar with Gradle
28-
run: ./gradlew assembleDebug
28+
run: ./gradlew assembleOpensource
2929
- name: Publish aar to Maven
3030
run: ./gradlew publish
31+
- name: Archive the apk
32+
uses: actions/upload-artifact@v2
33+
with:
34+
path: app/build/outputs/apk/opensource/release/*.apk
3135
- name: Upload apk to PGY
3236
run: |
33-
mv app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/debug/iot-link-android.apk
34-
curl -F 'file=@app/build/outputs/apk/debug/iot-link-android.apk' -F '_api_key=${{ secrets.RELEASE_PGYER_API_KEY }}' https://www.pgyer.com/apiv2/app/upload
37+
apk=$(ls app/build/outputs/apk/opensource/release/*.apk)
38+
curl -F "file=@${apk}" -F '_api_key=${{ secrets.RELEASE_PGYER_API_KEY }}' https://www.pgyer.com/apiv2/app/upload

.github/workflows/release.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,34 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v2
20-
- run:
21-
gpg -d --passphrase "${{ secrets.GPG_DECRYPT_PASSPHRASE }}" --batch release_keystore.jks.asc > release_keystore.jks
20+
- run: |
21+
rm -rf opensource_keystore.jks app-config.json app/google-services.json
22+
gpg -d --passphrase "${{ secrets.GPG_DECRYPT_PASSPHRASE }}" --batch .github/tencent_official_keystore.jks.asc > tencent_official_keystore.jks
23+
gpg -d --passphrase "${{ secrets.GPG_DECRYPT_PASSPHRASE }}" --batch .github/app-config.json.asc > app-config.json
24+
gpg -d --passphrase "${{ secrets.GPG_DECRYPT_PASSPHRASE }}" --batch .github/app/google-services.json.asc > app/google-services.json
2225
- name: set up JDK 1.8
2326
uses: actions/setup-java@v1
2427
with:
2528
java-version: 1.8
2629
- name: Adapt build.gradle from debug to release
2730
run: |
28-
sed -i 's#opensource_keystore#release_keystore#g' app/build.gradle
31+
sed -i 's#opensource_keystore#tencent_official_keystore#g' app/build.gradle
32+
sed -i '/opensource {/, +3d' app/build.gradle
33+
sed -i 's#//*##g' app/build.gradle
2934
sed -i "s#'111222'#System.getenv(\"RELEASE_KEYSTORE_PASSWORD\")#g" app/build.gradle
3035
sed -i 's#sdk-debug#sdk-release#g' sdk/build.gradle
3136
sed -i 's#-SNAPSHOT##g' sdk/build.gradle
3237
- name: Build with Gradle
3338
run: ./gradlew build
3439
- name: Package apk and aar with Gradle
35-
run: ./gradlew assembleRelease
40+
run: ./gradlew assembleTencentOfficial
3641
- name: Publish aar to Maven
3742
run: ./gradlew publish
43+
- name: Archive the apk
44+
uses: actions/upload-artifact@v2
45+
with:
46+
path: app/build/outputs/apk/tencentOfficial/release/*.apk
3847
- name: Upload apk to PGY
3948
run: |
40-
mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/iot-link-android.apk
41-
curl -F 'file=@app/build/outputs/apk/release/iot-link-android.apk' -F '_api_key=${{ secrets.RELEASE_PGYER_API_KEY }}' https://www.pgyer.com/apiv2/app/upload
49+
apk=$(ls app/build/outputs/apk/tencentOfficial/release/*.apk)
50+
curl -F "file=@${apk}" -F '_api_key=${{ secrets.RELEASE_PGYER_API_KEY }}' https://www.pgyer.com/apiv2/app/upload

app/build.gradle

+19
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ android {
4646
buildConfigField 'String', 'TencentIotLinkAppSecrect', "\"${getValueById('TencentIotLinkAppSecrect')}\""
4747
multiDexEnabled true
4848
}
49+
50+
flavorDimensions "version"
51+
productFlavors {
52+
opensource {
53+
applicationId "com.tencent.iot.explorer.link.opensource"
54+
resValue("string" , "app_name","连连开源体验")
55+
}
56+
//*tencentOfficial {
57+
//* applicationId "com.tencent.iot.explorer.link"
58+
//* resValue("string" , "app_name","腾讯连连")
59+
//*}
60+
}
61+
4962
buildTypes {
5063
debug {
5164
signingConfig signingConfigs.config
@@ -65,6 +78,12 @@ android {
6578
repositories {
6679
flatDir { dirs 'libs' }
6780
}
81+
applicationVariants.all { variant ->
82+
variant.outputs.all {
83+
def date = new Date().format("yyyyMMddHHmmss" , TimeZone.getTimeZone("GMT+08"))
84+
outputFileName = "iot-link-android-${date}.apk"
85+
}
86+
}
6887
}
6988

7089
dependencies {

app/src/main/res/values-w820dp/dimens.xml

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
33
(such as screen margins) for screens with more than 820dp of available width. This
44
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5-
<dimen name="activity_horizontal_margin">64dp</dimen>
65
</resources>

app/src/main/res/values/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<resources>
2-
<string name="app_name">腾讯连连</string>
3-
42
<!-- 主页面 -->
53
<string name="main_tab_1">首页</string>
64
<string name="main_tab_2">场景</string>

config.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
def gitCommitShortHash = 'git log -1 --pretty=%h'.execute([], project.rootDir).text.trim()
12
ext {
23
android = [
3-
versionName: "1.0.24",
4-
versionCode: 24
4+
versionName: "1.0.0." + gitCommitShortHash,
5+
versionCode: 1
56
]
67
}

opensource_keystore.jks

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)