Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bccc568f authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

am: add gitlab CI

parent 3351f1e7
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+52 −0
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"

stages:
  - update-from-upstream
  - build

before_script:
  - export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
  - export GRADLE_USER_HOME=$(pwd)/.gradle
  - chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
    - .gradle/

buildDebug:
  stage: build
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
      - app/build/outputs/apk/ose/debug

buildRelease:
  stage: build
  script:
    - ./gradlew assembleRelease
  artifacts:
    paths:
      - app/build/outputs/apk/ose/release

update-from-upstream:
  stage: update-from-upstream
  image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:slim-latest
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_NAME == "main-ose"'
  before_script:
    - eval "$(ssh-agent -s)"
    - echo "$SSH_E_ROBOT_PRIVATE_KEY" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh && chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts
    - git config --global user.email "$GITLAB_USER_EMAIL"
    - git config --global user.name "$GITLAB_USER_NAME"
  script:
    - git clone git@gitlab.e.foundation:$CI_PROJECT_PATH repo && cd repo
    - git checkout main-ose
    - git remote add upstream https://github.com/bitfireAT/davx5-ose
    - git fetch upstream --tags --prune --force
    - LATEST_TAG=$(git ls-remote --tags upstream | awk -F/ '{print $NF}' | grep -v '{}' | sort -Vr | head -n1)
    - git merge --no-edit "refs/tags/$LATEST_TAG"
    - git push origin main-ose