-
Notifications
You must be signed in to change notification settings - Fork 22
77 lines (68 loc) · 2.47 KB
/
opensource.yml
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
name: Android CI
on:
push:
paths-ignore: # 有時候不想要改個文档也触发 github actions
- '**.md'
- 'LICENSE'
tags-ignore: # 屏蔽掉发release打tag事件
- '*'
branches:
- '*'
env:
IOT_SONATYPE_USERNAME: ${{ secrets.IOT_SONATYPE_USERNAME }}
IOT_SONATYPE_PASSWORD: ${{ secrets.IOT_SONATYPE_PASSWORD }}
GPG_DECRYPT_PASSPHRASE: ${{ secrets.GPG_DECRYPT_PASSPHRASE }}
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: |
rm -rf sdkdemo-config.json
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/sdkdemo/sdkdemo-config.json.asc > sdkdemo-config.json
- name: set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
# - name: Setup cmake
# uses: jwlawson/[email protected]
# with:
# cmake-version: '3.10.2'
- name: Use cmake
run: |
cmake --version
- name: install fir
run: sudo gem install fir-cli
- name: Fix App Version
run: |
rb=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
rc=$(git rev-parse --short HEAD)
sed -i 's#def versionAppName.*#def versionAppName = \"'$rb'+git.'$rc'\"#g' config.gradle
sed -i "s#xxx#$rb+git.$rc#g" config.gradle
- name: Update SDK Version
run: bash .github/scripts/updateVersionCodeForSnapshot.sh
- name: Build with Gradle
run: ./gradlew build
- name: Package apk and aar with Gradle
run: ./gradlew assembleOpensource
- name: Publish aar to Maven
run: ./gradlew publish
- name: Archive the apk
uses: actions/upload-artifact@v2
with:
path: app/build/outputs/apk/opensource/release/*.apk
- name: Build demo apk
run: |
./gradlew :sdkdemo:assembleRelease
- name: Deploy App to fir
run: |
apk=$(ls app/build/outputs/apk/opensource/release/*.apk)
demoApk=$(ls sdkdemo/build/outputs/apk/release/sdkdemo-release.apk)
rc=$(git rev-parse --short HEAD)
rl=$(git log --pretty=format:"%s" $rc -1)
fir publish $apk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V
fir publish $demoApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V
env:
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }}