.gitlab-ci.yml 1.38 KB
Newer Older
genofire's avatar
genofire committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
image: registry.gitlab.com/fdroid/ci-images-client:latest

cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

stages:
  - build

before_script:
  - export GRADLE_USER_HOME=$PWD/.gradle
  - export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
  - echo y | sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null

build:
  stage: build
18
  except:
19
  - master
genofire's avatar
genofire committed
20 21 22 23 24 25
  script:
  - ./gradlew assemble
  artifacts:
    paths:
    - app/build/outputs/

26 27 28
publish:
  stage: build
  only:
29
  - master
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
  script:
  # workaround for deploy release in fdroid nightly
  - sed -i "s/-debug.apk/-unsigned.apk/" /usr/lib/python3/dist-packages/fdroidserver/nightly.py
  # generate new version
  - 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}'"
  - sed -i "s/^\(\s*versionCode\s*\).*$/\1$versionCode/" build.gradle
  - sed -i "0,/versionName/s/^\(\s*versionName\).*/\1 \"$versionName\"/" build.gradle
  - cat -n build.gradle
  # build free version
  - ./gradlew assemble
  # publish on nightly fdroid repo
  - fdroid nightly -v

genofire's avatar
genofire committed
45 46 47 48
after_script:
  # this file changes every time but should not be cached
  - rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
  - rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/