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

Commit 7c2aed24 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Remove update from upstream stage

parent 92260c05
Loading
Loading
Loading
Loading
Loading
+2 −51
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
- publish

@@ -12,10 +11,10 @@ before_script:
- if [ -d "/srv/userscripts" ]; then cp -R userscripts/* /srv/userscripts ; fi
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_ENV" | tr -d '\r' | ssh-add - > /dev/null
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS_ENV" > ~/.ssh/known_hosts
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
@@ -64,51 +63,3 @@ publish:
           --data "{\"ref\":\"${CI_COMMIT_SHA}\",\"name\":\"${CI_COMMIT_TAG}\",\"tag_name\":\"${CI_COMMIT_TAG}\",\"description\":\"${CI_COMMIT_TITLE}\",\"assets\":{\"links\":[{\"name\":\"GmsCore-test.apk\",\"url\":\"https://gitlab.e.foundation/api/v4/projects/149/jobs/artifacts/${CI_COMMIT_TAG}/raw/play-services-core/build/outputs/apk/withMapboxWithNearby/releaseTest/play-services-core-withMapbox-withNearby-releaseTest.apk?job=build-release\",\"link_type\":\"package\"},{\"name\":\"GmsCore-dev.apk\",\"url\":\"https://gitlab.e.foundation/api/v4/projects/149/jobs/artifacts/${CI_COMMIT_TAG}/raw/play-services-core/build/outputs/apk/withMapboxWithNearby/releaseDev/play-services-core-withMapbox-withNearby-releaseDev.apk?job=build-release\",\"link_type\":\"package\"},{\"name\":\"GmsCore-stable.apk\",\"url\":\"https://gitlab.e.foundation/api/v4/projects/149/jobs/artifacts/${CI_COMMIT_TAG}/raw/play-services-core/build/outputs/apk/withMapboxWithNearby/releaseStable/play-services-core-withMapbox-withNearby-releaseStable.apk?job=build-release\",\"link_type\":\"package\"}]}}" \
           --request POST https://gitlab.e.foundation/api/v4/projects/149/releases
.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:
    CI_PROJECT_SSH_URL: git@gitlab.e.foundation:$CI_PROJECT_PATH
    GIT_STRATEGY: none
  before_script:
    - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - echo "${SSH_PRIVATE_KEY_ENV}" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "${SSH_KNOWN_HOSTS}" > ~/.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:
# update $UPSTREAM_BRANCH & tags
    - git fetch origin
    - git checkout $LOCAL_BRANCH
    - git remote add upstream $UPSTREAM_URL
    - git fetch upstream
# checkout to latest tag commit to $TEMP_LATEST_TAG_BRANCH
    - git checkout $(git describe --tags --abbrev=0)
    - git checkout -b $TEMP_LATEST_TAG_BRANCH
# merge $LOCAL_BRANCH with $TEMP_LATEST_TAG_BRANCH & push
    - git checkout $LOCAL_BRANCH
    - git merge $TEMP_LATEST_TAG_BRANCH
    - git push origin $LOCAL_BRANCH
# remove unwanted local branch & remote
    - git branch -D $TEMP_LATEST_TAG_BRANCH
    - git remote remove upstream

update-default-branch:
  extends: .update-from-upstream
  variables:
    LOCAL_BRANCH: master
    UPSTREAM_BRANCH: upstream/master
    UPSTREAM_DEFAULT_BRANCH: master
    UPSTREAM_URL: https://github.com/microg/GmsCore.git
    TEMP_LATEST_TAG_BRANCH: latest_upstream_tag_branch