Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

improve the bulk pr script #600

Merged
merged 1 commit into from
Aug 29, 2023
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
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ Once all changes are on the main branch, follow these steps:

A new release needs to be deployed on the various docs sites that consume `dr-ui`. Two scripts have been configured to perform this task. Both scripts do the same task, so please choose one option and run that only.

### First Script
The first script, `scripts/create-pull-request.sh`, includes a sequence of shell commands to navigate to a docs repo on your local dev environment, run `npm install @mapbox/dr-ui` to install a specific version of `dr-ui`, commit `package.json` and `package.lock` to a new branch, and create a github pull request. It must be run once for every docs repo using dr-ui, a total of 16.
### Pull Request Script

`scripts/create-pull-request.sh` includes a sequence of shell commands to navigate to a docs repo on your local dev environment, run `npm install @mapbox/dr-ui` to install a specific version of `dr-ui`, commit `package.json` and `package.lock` to a new branch, and create a github pull request.

This script should be run from the root of this repository, and requires you to have [github cli](https://cli.github.com/) installed.

Expand All @@ -92,8 +93,9 @@ Example: `sh scripts/create-pull-request.sh 5.1.12 mapbox-gl-js-docs`

Repeat for all docs sites that need the update, and merge PRs through your normal workflow.

### Second Script
The second script, `scripts/update-dr-ui-all.sh`, includes the sequence of shell commands of the first script, but copied for each repo that must be updated. It should be run only one time total.
### Bulk Pull Request Script

`scripts/update-dr-ui-all.sh`, iterates over the repositories listed in `scripts/target-repositories.json` and runs `create-pull-request.sh` for each one. Make sure you have each of the target repositories cloned to your local machine.

This script should be run from the root of this repository, and requires you to have [github cli](https://cli.github.com/) installed.

Expand All @@ -103,6 +105,3 @@ To use:
- From the root of this repository, run `sh scripts/update-dr-ui-all.sh [dr-ui version]`

Example: `sh scripts/update-dr-ui-all.sh 5.1.12`


Again, run this script only once, and merge PRs through your normal workflow.
17 changes: 17 additions & 0 deletions scripts/target-repositories.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
"subdomain-docs-root",
"help",
"android-docs",
"ios-sdk",
"mapbox-gl-js-docs",
"atlas-docs",
"unity-sdk",
"studio-manual",
"api-documentation",
"data-docs",
"gl-js-seats",
"account-docs",
"playground",
"mts-docs",
"search-js-docs"
]
285 changes: 6 additions & 279 deletions scripts/update-dr-ui-all.sh
Original file line number Diff line number Diff line change
@@ -1,279 +1,6 @@
echo $1
nvm use 14
echo " "

echo "account-docs"
cd ../account-docs
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "account-docs COMPLETE"
echo "----------------------------------"
echo " "

echo "api-documentation"
cd ../api-documentation
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "api-documentation COMPLETE"
echo "----------------------------------"
echo " "

echo "atlas-docs"
cd ../atlas-docs
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "atlas-docs COMPLETE"
echo "----------------------------------"
echo " "

echo "data-docs"
cd ../data-docs
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "data-docs COMPLETE"
echo "----------------------------------"
echo " "

echo "docs-starter-kit"
cd ../docs-starter-kit
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "docs-starter-kit COMPLETE"
echo "----------------------------------"
echo " "

echo "documentation"
cd ../documentation
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "documentation COMPLETE"
echo "----------------------------------"
echo " "

echo "gl-js-seats"
cd ../gl-js-seats
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "gl-js-seats COMPLETE"
echo "----------------------------------"
echo " "

echo "help"
cd ../help
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "help COMPLETE"
echo "----------------------------------"
echo " "

echo "mapbox-gl-js-docs"
cd ../mapbox-gl-js-docs
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "mapbox-gl-js-docs COMPLETE"
echo "----------------------------------"
echo " "

echo "mts-docs"
cd ../mts-docs
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "mts-docs COMPLETE"
echo "----------------------------------"
echo " "

echo "playground"
cd ../playground
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "playground COMPLETE"
echo "----------------------------------"
echo " "

echo "subdomain-docs-root"
cd ../subdomain-docs-root
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "subdomain-docs-root COMPLETE"
echo "----------------------------------"
echo " "

echo "unity-sdk"
cd ../unity-sdk
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "unity-sdk COMPLETE"
echo "----------------------------------"
echo " "

nvm use 16

echo "android-docs"
cd ../android-docs
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "android-docs COMPLETE"
echo "----------------------------------"
echo " "

echo "ios-sdk"
cd ../ios-sdk
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "ios-sdk COMPLETE"
echo "----------------------------------"
echo " "

echo "studio-manual"
cd ../studio-manual
git checkout publisher-production
git branch -D update-dr-ui-$1
git pull origin publisher-production
git checkout -b update-dr-ui-$1
npm install @mapbox/dr-ui@$1
git add package.json package-lock.json
git commit -m "upgrade dr-ui to $1"
git push --set-upstream --force origin update-dr-ui-$1
echo "----------------------------------"
echo "PULL REQUEST LINK BELOW"
gh pr create --fill
echo "studio-manual COMPLETE"
echo "----------------------------------"
echo " "

echo "dr-ui updates pushed, but not merged. Export this console output and Ctrl+F 'Creating pull request for' to open PRs."
#!/bin/bash
# useage: sh scripts/update-dr-ui-all.sh X.X.X
jq -c -r '.[]' ./scripts/target-repositories.json | while read i; do
echo Running pull request script for $i
sh ./scripts/create-pull-request.sh $1 $i
done
Loading