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

Commit f011e4a4 authored by Jackeagle's avatar Jackeagle
Browse files

Merge branch '1187devices-master-add-ci-to-import-device-from-upstream' into 'master'

Add gitlab-ci to import device updates from upstream

See merge request e/templates!44
parents 2c40a752 10fbca12
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
# uses
# SSH_E_ROBOT_PRIVATE_KEY defined in e group
# SSH_KNOWN_HOSTS defined in e group

variables:
  CI_PROJECT_SSH_URL: git@gitlab.e.foundation:$CI_PROJECT_PATH

.update-from-upstream:
  image: registry.gitlab.e.foundation/e/tools/docker-tools:latest
  stage: update-from-upstream
  rules:
    - if: '$CI_PIPELINE_SOURCE =~ /schedule/ && $CI_COMMIT_REF_NAME == $LOCAL_BRANCH'
  variables:
    GIT_STRATEGY: none
  before_script:
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - echo "${SSH_E_ROBOT_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "${SSH_KNOWN_HOSTS}" > /root/.ssh/known_hosts
    - echo "${SSH_KNOWN_HOSTS}"
    - chmod 644 ~/.ssh/known_hosts
    - git config --global user.email $GITLAB_USER_EMAIL
    - git config --global user.name "$GITLAB_USER_NAME"
    - cd $CI_BUILD_DIR
    - rm -rf $CI_PROJECT_DIR
    - git clone $CI_PROJECT_SSH_URL $CI_PROJECT_DIR
    - cd $CI_PROJECT_DIR
  script:
    - git fetch origin
    - git checkout $CI_COMMIT_REF_NAME
    - git merge origin/$UPSTREAM_BRANCH
    - git push

u:
  extends: .update-from-upstream
  variables:
    UPSTREAM_BRANCH: lineage-21
    LOCAL_BRANCH: v1-u

a14:
  extends: .update-from-upstream
  variables:
    UPSTREAM_BRANCH: lineage-21
    LOCAL_BRANCH: a14