image: openjdk:8-jdk
variables:
SOURCE_FILE_PATH: "./app/build/outputs/apk/*"
TARGET_FILE_PATH: "/home/android-apk/ProjectName/app/"
before_script:
- export ANDROID_HOME=/opt/android_sdk/
- export PATH=$PATH:/opt/android_sdk/platform-tools/
- chmod +x ./gradlew
stages:
- build
- assemble
- deploy
job_build:
stage: build
script:
- ./gradlew clean
- ./gradlew assembleRelease
only:
- master
job_assemble:
stage: assemble
script:
- ./gradlew clean
- ./gradlew app:assembleRelease
- 'mkdir -p ${TARGET_FILE_PATH}/assemble/'
- 'cp -fRap ${SOURCE_FILE_PATH} ${TARGET_FILE_PATH}/assemble/'
artifacts:
paths:
- ./app/build/outputs/
only:
- /^V.*$/
except:
- branches
复制代码
Build Job - job_build
=================================
Tag list:
Only policy: refs, master
Except policy:
Environment:
When: on_success
复制代码
Assemble Job - job_assemble
=================================
Tag list:
Only policy: refs, /^V.*$/
Except policy: refs, branches
Environment:
When: on_success
复制代码