summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: edd6100596ded533ee54f80d7ec08515a5b22195 (plain)
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
image: registry.gitlab.com/fdroid/ci-images-client:latest

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

stages:
  - test
  - deploy

test:
  stage: test
  script: ./gradlew lint assembleRelease

deploy_nightly:
  stage: deploy
  only:
    - master
  script:
    # Ensure that key exists
    - test -z "$DEBUG_KEYSTORE" && exit 0
    # Rename nightly app
    - sed -i
        's,<string name="app_name">.*</string>,<string name="app_name">Cashier Nightly</string>,'
        app/src/main/res/values*/strings.xml
    # Set time-based version code
    - export versionCode=$(date '+%s')
    - sed -i "s,^\(\s*versionCode\) *[0-9].*,\1 $versionCode," app/build.gradle
    # Set nightly application ID
    - sed -i "s,^\(\s*applicationId\) \"*[a-z\.].*\",\1 \"net.taler.cashier.nightly\"," app/build.gradle
    # Build the APK
    - ./gradlew assembleDebug
    - CI_PROJECT_URL="https://gitlab.com/gnu-taler/fdroid-repo" CI_PROJECT_PATH="gnu-taler/fdroid-repo" fdroid nightly -v

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/