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

Commit e7f98ced authored by Jonathan Klee's avatar Jonathan Klee
Browse files

ci: make update-from-upstream job rebase on upstream release

parent a85d97cf
Loading
Loading
Loading
Loading
Loading
+7 −20
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ create-release:
  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'
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_NAME == "develop-rebased"'
  variables:
    CI_PROJECT_SSH_URL: git@gitlab.e.foundation:$CI_PROJECT_PATH
    GIT_STRATEGY: none
@@ -151,30 +151,17 @@ create-release:
    - git clone $CI_PROJECT_SSH_URL $CI_PROJECT_DIR
    - cd $CI_PROJECT_DIR
  script:
    # update $UPSTREAM_BRANCH & tags
    - git fetch origin
    - git checkout $UPSTREAM_BRANCH
    # Rebase local branch on upstream default branch.
    - git remote add upstream $UPSTREAM_URL
    - git fetch upstream
    - git pull upstream $UPSTREAM_DEFAULT_BRANCH
    - git push origin $UPSTREAM_BRANCH
    - git push origin --tags
    # 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 fetch origin --prune
    - git fetch upstream --prune --no-tags
    - 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
    - git rebase upstream/$UPSTREAM_DEFAULT_BRANCH
    - git push origin $LOCAL_BRANCH -f

update-default-branch:
  extends: .update-from-upstream
  variables:
    LOCAL_BRANCH: develop
    UPSTREAM_BRANCH: upstream/release
    LOCAL_BRANCH: develop-rebased
    UPSTREAM_DEFAULT_BRANCH: release
    UPSTREAM_URL: https://github.com/thunderbird/thunderbird-android
    TEMP_LATEST_TAG_BRANCH: latest_upstream_tag_branch