.gitlab-ci.yml 2.8 KB
Newer Older
CapsLock's avatar
CapsLock committed
1
image: "debian:latest"
CapsLock's avatar
CapsLock committed
2 3
stages:
  - build
CapsLock's avatar
CapsLock committed
4
patch_and_build_signal:
CapsLock's avatar
CapsLock committed
5 6 7
  stage: build
  script:
    - "apt update && apt install -y git"
CapsLock's avatar
CapsLock committed
8
    - "apt install -y default-jdk"
CapsLock's avatar
CapsLock committed
9 10 11 12
    - "apt install -y lib32stdc++6 unzip wget opensc"
    - "wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" # download android sdk
    - "echo '92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9  sdk-tools-linux-4333796.zip' |sha256sum -c"
    - "unzip sdk-tools-linux-4333796.zip -d /sdk-tools-linux" # unzip android sdk
CapsLock's avatar
CapsLock committed
13 14 15 16
    - "yes | /sdk-tools-linux/tools/bin/sdkmanager --licenses || true" # to accept licenses
    - "export JAVA_OPTS=\"-Xmx3096M\""
    - "export GRADLE_OPTS=\"-Dorg.gradle.jvmargs=-Xmx4608M\""
    - "export ANDROID_HOME=\"/sdk-tools-linux\"" # set ANDROID_HOME env var
CapsLock's avatar
CapsLock committed
17
    - "git clone https://github.com/WhisperSystems/Signal-Android.git && cd Signal-Android && git checkout v4.31.2" # get signal sources
18
    - "for f in res/values*/strings.xml; do sed -i 's/<string.*name=\"app_name\".*>.*<\\/string>/<string name=\"app_name\">Langis<\\/string>/g' \"$f\"; done" # app rename
CapsLock's avatar
CapsLock committed
19 20
    - "./gradlew clean" # cleanup
    - "git apply $CI_PROJECT_DIR/destroy-gcm-support.patch" # apply our patch
CapsLock's avatar
CapsLock committed
21 22
    - "git apply $CI_PROJECT_DIR/fix-build-regretion-on-v4.30.2.patch"
    - "./gradlew --stacktrace assembleWebsiteRelease" #assembleWebsiteDebug
CapsLock's avatar
CapsLock committed
23 24 25 26
    - "mkdir -p $CI_PROJECT_DIR/artifacts"
    - "find $CI_PROJECT_DIR/Signal-Android/build/outputs -name *.apk"
    - "mv $(find $CI_PROJECT_DIR/Signal-Android/build/outputs -name *.apk) $CI_PROJECT_DIR/artifacts"
    - "ls -lh $CI_PROJECT_DIR/artifacts"
27 28 29 30 31 32
    # To sign packages ; you'll need a keystore with your certificate
    # signing packages is important, it also allows application update without removing previous installed version of the app
    # To build the keystore used here, we use:
    #   keytool -genkey -v -keystore keystore.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias app
    #   cat keystore.keystore | base64 > keystore.base64
    # then we provide that base64 encoded file to the CI ; you'll get it back to its original format write after this command is run:
CapsLock's avatar
CapsLock committed
33
    - "echo \"$KEYSTORE_CRT\" |base64 -d > /keystore.keystore"
CapsLock's avatar
CapsLock committed
34
    - "for f in $CI_PROJECT_DIR/artifacts/*unsigned*.apk; do SIGNED_FNAME=\"$(echo $f |sed 's/unsigned/signed/g')\"; echo \"Signing $f\"; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /keystore.keystore -storepass \"$KEYSTORE_PASSPHR\" $f -signedjar \"$SIGNED_FNAME\" app ;done"
35
    - "rm $CI_PROJECT_DIR/artifacts/*unsigned*.apk"
CapsLock's avatar
CapsLock committed
36
    - "cd $CI_PROJECT_DIR/artifacts/ && for f in $(find . -iname \"*signal*.apk\"); do mv \"$f\" \"$(echo $f|sed \"s/[Ss][Ii][Gg][Nn][Aa][Ll]/langis/\")\"; done"
CapsLock's avatar
CapsLock committed
37
    - "ls -lh $CI_PROJECT_DIR/artifacts"
CapsLock's avatar
CapsLock committed
38
  artifacts:
CapsLock's avatar
CapsLock committed
39
    paths:
CapsLock's avatar
CapsLock committed
40
      - "$CI_PROJECT_DIR/artifacts/*.apk"
CapsLock's avatar
CapsLock committed
41 42 43 44