From ce3ba00c92ed7a925ac89bee3c381c330a2675fd Mon Sep 17 00:00:00 2001 From: "sevastian.zhukov" Date: Thu, 1 Dec 2022 19:46:54 +0700 Subject: [PATCH 1/4] Remove approval for publish doc job --- .circleci/config.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fb249cad8..fb36cd36c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -253,18 +253,8 @@ workflows: name: "SPM Ubuntu build" - example-app-build: name: "Build example app" - - approve-publish-documentation: - name: "Approve Publish Documentation" - type: approval - filters: &filters-tag-push - tags: - only: /^v\d+\.\d+\.\d+(-.+)?$/ - branches: - ignore: /.*/ - publish-documentation: name: "Publish Documentation" - requires: - - "Approve Publish Documentation" - filters: - <<: *filters-tag-push - + filters: + tags: + only: /^v\d+\.\d+\.\d+(-.+)?$/ From b7cb30d0221fdf321f6f9553ed4f48b1d0055533 Mon Sep 17 00:00:00 2001 From: "sevastian.zhukov" Date: Thu, 1 Dec 2022 21:41:39 +0700 Subject: [PATCH 2/4] distribute and update version workflows --- .circleci/config.yml | 119 +++++++++++++++++++++++++++++++++++++- scripts/update-version.sh | 22 +++++++ 2 files changed, 139 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fb36cd36c..100e908f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,14 +42,14 @@ commands: steps: - run: name: Dependencies - command: carthage bootstrap --platform all --cache-builds --configuration Debug --use-xcframeworks + command: carthage bootstrap --platform all --cache-builds --configuration Debug --use-xcframeworks install-mbx-ci: steps: - run: name: "Install MBX CI" command: | curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-darwin-amd64 > /usr/local/bin/mbx-ci - chmod 755 /usr/local/bin/mbx-ci + chmod 755 /usr/local/bin/mbx-ci setup-write-repo-access: steps: - run: @@ -61,6 +61,51 @@ commands: git config user.email "release-bot@mapbox.com" git config user.name "Mapbox Releases" +step-library: + - &restore-cache-gems + restore_cache: + keys: + - 1-gems-{{ checksum "Gemfile.lock" }} + + - &install-gems + run: + name: Install Gems + command: | + bundle config set path 'vendor/bundle' + bundle check || bundle install + + - &save-cache-gems + save_cache: + key: 1-gems-{{ checksum "Gemfile.lock" }} + paths: + - vendor/bundle + + - &restore-cache-podmaster + restore_cache: + keys: + - podmaster-cache + + - &save-cache-podmaster + save_cache: + key: podmaster-cache + paths: + - "~/.cocoapods/repos/master" + + - &prepare-netrc-file + run: + name: Prepare .netrc file + command: | + echo "machine api.mapbox.com" >> ~/.netrc + echo "login mapbox" >> ~/.netrc + echo "password $SDK_REGISTRY_TOKEN" >> ~/.netrc + chmod 0600 ~/.netrc + + - &add-github-to-known-hosts + run: + name: Add GitHub to known hosts + command: | + for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts + jobs: detect-breaking-changes: macos: @@ -230,6 +275,64 @@ jobs: command: | git push origin $(git rev-parse --abbrev-ref HEAD):publisher-production + update-version-job: + parameters: + xcode: + type: string + default: "13.4.1" + macos: + xcode: << parameters.xcode >> + environment: + HOMEBREW_NO_AUTO_UPDATE: 1 + steps: + - checkout + - *restore-cache-gems + - *restore-cache-podmaster + - *install-gems + - *prepare-netrc-file + - *add-github-to-known-hosts + - install-mbx-ci + - run: + name: Update version + command: | + export GITHUB_WRITER_TOKEN=$(mbx-ci github writer public token) + git remote set-url origin "https://x-access-token:$GITHUB_WRITER_TOKEN@github.com/mapbox/mapbox-directions-swift" + git config --global user.email no-reply@mapbox.com && git config --global user.name mapbox-ci + VERSION=$( echo << pipeline.git.branch >> | sed 's/^trigger-update-version-//' ) + ./scripts/update-version.sh v$VERSION + - *save-cache-podmaster + - *save-cache-gems + + distribute-version-job: + parameters: + xcode: + type: string + default: "13.4.1" + macos: + xcode: << parameters.xcode >> + environment: + HOMEBREW_NO_AUTO_UPDATE: 1 + steps: + - checkout + - *restore-cache-gems + - *restore-cache-podmaster + - *install-gems + - *prepare-netrc-file + - *add-github-to-known-hosts + - install-mbx-ci + - run: + name: Update version + command: | + VERSION=$( echo << pipeline.git.branch >> | sed 's/^trigger-distribute-version-//' ) + if [[ $VERSION == *alpha* || $VERSION == *beta* || $VERSION == *rc* ]]; then + pod repo update && pod trunk push MapboxDirections-pre.podspec + else + pod repo update && pod trunk push MapboxDirections.podspec + fi + pod repo update && pod trunk push MapboxDirections.podspec + - *save-cache-podmaster + - *save-cache-gems + workflows: workflow: jobs: @@ -258,3 +361,15 @@ workflows: filters: tags: only: /^v\d+\.\d+\.\d+(-.+)?$/ + update-version-workflow: + jobs: + - update-version-job: + filters: + branches: + only: /^trigger-update-version-.*/ + distribute-version-workflow: + jobs: + - distribute-version-job: + filters: + branches: + only: /^trigger-distribute-version-.*/ \ No newline at end of file diff --git a/scripts/update-version.sh b/scripts/update-version.sh index b62531864..ecfb0f1c2 100755 --- a/scripts/update-version.sh +++ b/scripts/update-version.sh @@ -52,3 +52,25 @@ if [[ $1 != *alpha* && $1 != *beta* ]]; then step "Bumping API baseline" ./scripts/update-baseline.sh $1 fi + +BRANCH_NAME="update-version-${SEM_VERSION}" +git checkout -b $BRANCH_NAME +git add . +git commit -m "Update version ${SEM_VERSION}" +git push origin $BRANCH_NAME + +if [[ $SEM_VERSION =~ "alpha" || $SEM_VERSION =~ "beta" ]]; then + BASE_BRANCH_NAME="main" + else + MAJOR=${SEM_VERSION%%.*} + MINOR_TMP=${SEM_VERSION#*.} + MINOR=${MINOR_TMP%%.*} + BASE_BRANCH_NAME="release-v${MAJOR}.${MINOR}" +fi + +brew install gh +GITHUB_TOKEN=$GITHUB_WRITER_TOKEN gh pr create \ + --title "Release v${SEM_VERSION}" \ + --body "Bump version to ${SEM_VERSION}" \ + --base $BASE_BRANCH_NAME \ + --head $BRANCH_NAME From e93c276eea5845a460de3422d7870b8a52fadecb Mon Sep 17 00:00:00 2001 From: "sevastian.zhukov" Date: Fri, 2 Dec 2022 21:04:48 +0700 Subject: [PATCH 3/4] gitignore vendor/bundle/ruby/ --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 0603c1913..bfbefe41a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ Carthage/Checkouts /swift-package-baseline/*/MapboxDirections.json .build .vscode + +vendor/bundle/ruby/ \ No newline at end of file From 63c9cbeb5ef006c8c7c044e58e23be255fb8777c Mon Sep 17 00:00:00 2001 From: "sevastian.zhukov" Date: Fri, 2 Dec 2022 21:19:31 +0700 Subject: [PATCH 4/4] publish doc filter fix --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 100e908f7..2cb824a5a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -361,6 +361,8 @@ workflows: filters: tags: only: /^v\d+\.\d+\.\d+(-.+)?$/ + branches: + ignore: /.*/ update-version-workflow: jobs: - update-version-job: