Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release train preparation #775

Merged
merged 4 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 120 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -253,18 +356,22 @@ 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
- publish-documentation:
name: "Publish Documentation"
filters:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?$/
branches:
ignore: /.*/
- publish-documentation:
name: "Publish Documentation"
requires:
- "Approve Publish Documentation"
filters:
<<: *filters-tag-push

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-.*/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ Carthage/Checkouts
/swift-package-baseline/*/MapboxDirections.json
.build
.vscode

vendor/bundle/ruby/
22 changes: 22 additions & 0 deletions scripts/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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