| version: 2.1 |
| |
| orbs: |
| queue: eddiewebb/queue@1.1.2 |
| |
| commands: |
| checkout-indexes: |
| steps: |
| - run: |
| name: Checkout |
| command: | |
| mkdir -p ~/.ssh |
| |
| echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts |
| |
| if [ -e "/home/circleci/project/.git" ] |
| then |
| cd "/home/circleci/project" |
| git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true |
| |
| echo "Fetching $INDEXES_BRANCH ..." |
| git fetch --force origin "$INDEXES_BRANCH:remotes/origin/$INDEXES_BRANCH" |
| |
| echo "Resetting to origin/$INDEXES_BRANCH" |
| git reset --hard "origin/$INDEXES_BRANCH" |
| else |
| mkdir -p "/home/circleci/project" |
| cd "/home/circleci/project" |
| echo "Cloning $INDEXES_BRANCH ..." |
| git clone "$CIRCLE_REPOSITORY_URL" --single-branch --branch "$INDEXES_BRANCH" . |
| fi |
| |
| echo "Fetching '$CIRCLE_BRANCH' ..." |
| git fetch --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH" |
| |
| jobs: |
| update-indexes: |
| docker: |
| - image: circleci/ruby:2.4.1 |
| environment: |
| INDEXES_BRANCH: indexes |
| steps: |
| - queue/until_front_of_line |
| - restore_cache: |
| keys: |
| - indexes-source-{{ .Branch }}-{{ .Revision }} |
| - indexes-source-{{ .Branch }}- |
| - indexes-source- |
| - checkout-indexes |
| - run: |
| name: Git config |
| command: | |
| git config --global user.email "cocoapods@users.noreply.github.com" |
| git config --global user.name "cocoapods" |
| - add_ssh_keys: |
| fingerprints: |
| - "d1:7c:fc:8a:17:63:75:8e:ee:01:13:05:2b:28:ca:49" |
| - run: |
| name: Rebase latest changes |
| command: git rebase "$CIRCLE_SHA1" |
| - run: |
| name: Generate indexes for the changes |
| command: | |
| ./Scripts/add_incremental_index.sh "origin/$INDEXES_BRANCH" "$CIRCLE_SHA1" | tee /dev/tty | xargs git add |
| - run: |
| name: Amend commit and force push the changes |
| command: | |
| git commit --amend --date="$(date -R)" --no-edit --quiet |
| git push origin :"$INDEXES_BRANCH" # Temporary workaround for -f not working below |
| git push origin "$INDEXES_BRANCH" |
| - save_cache: |
| key: indexes-source-{{ .Branch }}-{{ .Revision }} |
| paths: |
| - ".git" |
| |
| workflows: |
| update-indexes: |
| jobs: |
| - update-indexes: |
| filters: |
| branches: |
| only: master |