Skip to content

Commit 10b508f

Browse files
persidskiyKylmakalle
authored andcommitted
Maps ios release gha (#3049)
https://mapbox.atlassian.net/browse/MAPSIOS-1799 This PR: - updates xcode to 16.2 for all projects - creates release-maps-ios.yml flow that can be dispatched manually, and also a last step of the CD pipeline The test release workflow (11.12.0-alpha.9) runs on separate branch that updates the versions.json https://github.com/mapbox/mapbox-sdk/actions/runs/14246856565 cc @mapbox/sdk-ci --------- Co-authored-by: Sergey Akentev <[email protected]> GitOrigin-RevId: 68cf71cee5dc5bc58da6e089b809afe38fe33345
1 parent 62c1bc1 commit 10b508f

File tree

2 files changed

+14
-87
lines changed

2 files changed

+14
-87
lines changed

scripts/release/create-docs-prs.sh

Lines changed: 10 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ CLA_SIGNED_GITHUB_EMAIL="[email protected]"
77

88
TMP_ROOT=$(mktemp -d)
99
WORKTREE_TO_REMOVE=""
10-
STAGING_ONLY=false
11-
EXTRA_EMPTY_COMMIT=false
1210

1311
# shellcheck disable=SC2317
1412
cleanup() {
@@ -33,12 +31,6 @@ main() {
3331
git_configure_release_user
3432
git config user.email "$CLA_SIGNED_GITHUB_EMAIL"
3533

36-
if [ "$STAGING_ONLY" = true ]; then
37-
step "Update mapbox/maps-ios@publisher-staging"
38-
maps_ios_upload_docs
39-
exit 0
40-
fi
41-
4234
brew_install_if_needed gh
4335

4436
step "Update mapbox/ios-sdk"
@@ -50,49 +42,6 @@ main() {
5042
exit 0
5143
}
5244

53-
maps_ios_upload_docs() {
54-
STAGING_BRANCH_NAME="publisher-staging"
55-
info "Checkout $STAGING_BRANCH_NAME worktree"
56-
local staging_docs_path="$TMP_ROOT/docs-staging"
57-
git worktree add "$staging_docs_path" "$STAGING_BRANCH_NAME" --quiet
58-
WORKTREE_TO_REMOVE="$staging_docs_path"
59-
60-
git -C "$staging_docs_path" reset --hard origin/publisher-production --quiet
61-
62-
info "Copy docs from $DOCS_PATH"
63-
cp -r "$DOCS_PATH" "$staging_docs_path/$VERSION"
64-
65-
pushd "$staging_docs_path" > /dev/null || exit 1
66-
git_configure_release_user
67-
git config user.email "$CLA_SIGNED_GITHUB_EMAIL"
68-
69-
git remote set-url origin "https://x-access-token:$(mbx-ci github writer public token)@github.com/mapbox/mapbox-maps-ios.git"
70-
71-
info "Commit"
72-
git add .
73-
git commit -m "Add documentation for v$VERSION" --quiet
74-
75-
info "Push"
76-
git push --force --verbose
77-
78-
if [ "$STAGING_ONLY" = true ]; then
79-
git push --force --verbose
80-
else
81-
VERSION_BRANCH_NAME="docs/$VERSION"
82-
git checkout -b "$VERSION_BRANCH_NAME"
83-
git push --set-upstream origin "$VERSION_BRANCH_NAME" --force --verbose
84-
fi
85-
86-
if [ "$EXTRA_EMPTY_COMMIT" = true ]; then
87-
info "Add empty commit to trigger CI"
88-
sleep 10 # Avoid CI sometimes cancelling the "Trigger CI" build
89-
git commit --allow-empty -m "Trigger CI" --quiet
90-
git push --force --verbose
91-
fi
92-
93-
popd > /dev/null
94-
}
95-
9645
should_update_version() {
9746
local new=$1
9847
local current=$2
@@ -111,7 +60,7 @@ ios_sdk_update_versions() {
11160

11261
info "Clone repository"
11362
[[ -d $IOS_SDK_REPO_PATH ]] && rm -rf "$IOS_SDK_REPO_PATH"
114-
git clone "https://x-access-token:$(mbx-ci github writer private token)@github.com/mapbox/ios-sdk.git" "$IOS_SDK_REPO_PATH" --branch publisher-production --depth=1 --quiet
63+
git clone "https://x-access-token:$GITHUB_WRITER_PRIVATE_TOKEN@github.com/mapbox/ios-sdk.git" "$IOS_SDK_REPO_PATH" --branch publisher-production --depth=1 --quiet
11564

11665
pushd "$IOS_SDK_REPO_PATH" || exit 1
11766

@@ -146,9 +95,9 @@ ios_sdk_update_versions() {
14695
ios_sdk_open_pr() {
14796
local body="* Release ${VERSION} documentation — Maps SDK for iOS
14897
Staging URL: https://docs.tilestream.net/ios/maps/api/$VERSION/index.html"
149-
GITHUB_TOKEN_WRITER=$(mbx-ci github writer private token)
98+
GITHUB_TOKEN_WRITER=$GITHUB_WRITER_PRIVATE_TOKEN
15099

151-
PR_URL=$(GITHUB_TOKEN=$GITHUB_TOKEN_WRITER \
100+
PR_URL=$(GITHUB_TOKEN=$GITHUB_WRITER_PRIVATE_TOKEN \
152101
gh pr create \
153102
--repo mapbox/ios-sdk \
154103
--base publisher-production \
@@ -157,46 +106,24 @@ ios_sdk_open_pr() {
157106
--label "Maps SDK" \
158107
--label "update" \
159108
--body "$body")
160-
GITHUB_TOKEN="$GITHUB_TOKEN_WRITER" gh pr merge --auto --squash "$PR_URL"
109+
GITHUB_TOKEN="$GITHUB_WRITER_PRIVATE_TOKEN" gh pr merge --auto --squash "$PR_URL"
161110

162-
repeat_command_until_it_fails "approve_pr" 15 20
111+
# repeat_command_until_it_fails "approve_pr" 15 20
163112

164113
info "New PR: $PR_URL"
165114
pwd
166115
popd
167116
echo "$PR_URL" > "ios-sdk-pr.txt"
117+
118+
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
119+
echo "Docs PR: $PR_URL " >> $GITHUB_STEP_SUMMARY
120+
fi
168121
}
169122

170123
# shellcheck disable=SC2317
171124
approve_pr() {
172-
GITHUB_TOKEN=$(mbx-ci github writer private token) gh pr review "$PR_URL" --approve
173-
}
174-
175-
print_usage () {
176-
cat <<HELP_USAGE
177-
Usage:
178-
$0 -p docs_path
179-
180-
-p Path to the generated docs to upload
181-
-s To upload docs to staging only
182-
-e Push an extra empty commit to trigger CI
183-
HELP_USAGE
125+
GITHUB_TOKEN=$GITHUB_WRITER_PRIVATE_TOKEN gh pr review "$PR_URL" --approve
184126
}
185127

186-
while getopts 'p:se' flag; do
187-
case "${flag}" in
188-
p) DOCS_PATH="$OPTARG"
189-
if [[ ! -d $DOCS_PATH ]]; then
190-
exit 1
191-
fi
192-
;;
193-
s) STAGING_ONLY=true
194-
;;
195-
e) EXTRA_EMPTY_COMMIT=true
196-
;;
197-
*) print_usage ;;
198-
esac
199-
done
200-
201128
set -x
202129
main

scripts/release/create-github-draft-release.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ set -euo pipefail
44

55
#
66
# Usage:
7-
# ./scripts/release/create-github-draft-release.sh <version-without-v-prefix>
7+
# ./scripts/release/create-github-draft-release.sh <version-without-v-prefix> <xcode-min-version>
88
#
99

1010
VERSION=$1
11+
XCODE_MIN_VERSION=$2
1112

1213
set -euo pipefail
1314
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
@@ -17,7 +18,7 @@ UTILS_PATH="$SCRIPT_DIR/../utils.sh"
1718
source "$UTILS_PATH"
1819

1920
main() {
20-
GITHUB_TOKEN=$(mbx-ci github reader token)
21+
GITHUB_TOKEN=$GITHUB_READER_PRIVATE_TOKEN
2122
export GITHUB_TOKEN
2223

2324
VERSION_JSON_PATH="$SCRIPT_DIR/packager/versions.json"
@@ -30,7 +31,6 @@ main() {
3031
MAPBOX_COREMAPS_VERSION=$(jq -r .MapboxCoreMaps "$VERSION_JSON_PATH")
3132
# The following python one-liner parses the CircleCI config and takes executor called 'xcode-sdk-min' and then checkout the macos xcode version.
3233
# It's critical to have the same structure in CircleCI config in any place inside of file.
33-
XCODE_MIN_VERSION=$(python3 -c "import yaml,sys;print(yaml.safe_load(sys.stdin)['macos']['xcode'])" < "$SCRIPT_DIR/../../../.circleci/config/executors/xcode-sdk-min.yml")
3434

3535
CHANGELOG=$( ([[ $(command -v parse-changelog) ]] && parse-changelog CHANGELOG.md) || echo "<Compose changelog here>" )
3636

@@ -50,7 +50,7 @@ $CHANGELOG
5050
* Compatible version of Xcode: \`$XCODE_MIN_VERSION\`
5151
EOF
5252

53-
PRODUCTION_DOCS_PR_URL=$(GITHUB_TOKEN=$(mbx-ci github writer public token) \
53+
PRODUCTION_DOCS_PR_URL=$(GITHUB_TOKEN=$GITHUB_WRITER_PUBLIC_TOKEN \
5454
gh release create "v$VERSION" --repo mapbox/mapbox-maps-ios \
5555
--prerelease \
5656
--draft \

0 commit comments

Comments
 (0)