Skip to content

实现打Release包时versionCode自增 #1114

实现打Release包时versionCode自增

实现打Release包时versionCode自增 #1114

Workflow file for this run

name: Android CI
on:
push:
paths-ignore: # 有時候不想要改個文档也触发 github actions
- 'doc/**'
- 'README.md'
- 'LICENSE'
tags-ignore: # 屏蔽掉发release打tag事件
- '*'
branches:
- '*'
env:
IOT_SONATYPE_USERNAME: ${{ secrets.IOT_SONATYPE_USERNAME }}
IOT_SONATYPE_PASSWORD: ${{ secrets.IOT_SONATYPE_PASSWORD }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- 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
- 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 --oversea_turbo --force_pin_history -V
env:
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }}