fix gitlab-ci build (#355)

This commit is contained in:
genofire 2019-06-22 17:33:32 +02:00 committed by Christian Schneppe
parent e3603f7c41
commit 4726fcfd46

View file

@ -4,11 +4,9 @@ cache:
paths: paths:
- .gradle/wrapper - .gradle/wrapper
- .gradle/caches - .gradle/caches
- .android
stages: stages:
- build - build
- test
before_script: before_script:
- export GRADLE_USER_HOME=$PWD/.gradle - export GRADLE_USER_HOME=$PWD/.gradle
@ -18,29 +16,40 @@ before_script:
build: build:
stage: build stage: build
#except:
#- master
script: script:
# generate version number # generate version number
- export versionCode=`printf $(git rev-list --first-parent --count HEAD)` - export versionCode="$CI_JOB_ID"
- export versionName=`printf '%s-%05d' $(git describe --tag --abbrev=0) $versionCode` - export versionName="$(git describe --tag --abbrev=0)-${CI_JOB_ID}_${CI_COMMIT_REF_NAME}"
- echo "set VersionCode '${versionCode}' and VersonName '${versionName}'"
- sed -i "s/^\(\s*versionCode\s*\).*$/\1$versionCode/" build.gradle
- sed -i "0,/versionName/s/^\(\s*versionName\).*/\1 \"$versionName\"/" build.gradle
# build
- ./gradlew assembleStandard
artifacts:
paths:
- build/outputs/apk/standard
publish:
stage: build
only:
#- master
- master--not-build-on-my-repo
script:
# generate version number
- export versionCode="$CI_JOB_ID"
- export versionName="$(git describe --tag --abbrev=0)-${CI_JOB_ID}_${CI_COMMIT_REF_NAME}"
- echo "set VersionCode '${versionCode}' and VersonName '${versionName}'" - echo "set VersionCode '${versionCode}' and VersonName '${versionName}'"
- sed -i "s/^\(\s*versionCode\s*\).*$/\1$versionCode/" build.gradle - sed -i "s/^\(\s*versionCode\s*\).*$/\1$versionCode/" build.gradle
- sed -i "0,/versionName/s/^\(\s*versionName\).*/\1 \"$versionName\"/" build.gradle - sed -i "0,/versionName/s/^\(\s*versionName\).*/\1 \"$versionName\"/" build.gradle
- cat -n build.gradle
# build # build
- ./gradlew assembleStandard - ./gradlew assembleStandard
# publish on nightly fdroid repo # publish on nightly fdroid repo
- fdroid nightly - fdroid nightly -v
artifacts: artifacts:
paths: paths:
- build/outputs/ - build/outputs/apk/standard
test:
stage: test
script:
- ./gradlew lint
artifacts:
paths:
- build/outputs/
after_script: after_script:
# this file changes every time but should not be cached # this file changes every time but should not be cached