-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update branch name reference from 'master' to 'main'
Summary: Step 1 to update Captum OSS default branch name from 'master' to 'main'. - Context see T200490048 - Instructions see [wiki](https://www.internalfb.com/intern/wiki/Open_Source/Maintain_a_FB_OSS_Project/Default_Branch_Name_Change/#1-before-you-use-the-too) TODO: update the OSS wiki accordingly Differential Revision: D64430568
- Loading branch information
1 parent
4cb2808
commit cc88299
Showing
15 changed files
with
30 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
WORK_DIR=$(mktemp -d) | ||
cd "${WORK_DIR}" || exit | ||
|
||
# Clone both master & gh-pages branches | ||
git clone [email protected]:pytorch/captum.git captum-master | ||
# Clone both main & gh-pages branches | ||
git clone [email protected]:pytorch/captum.git captum-main | ||
git clone --branch gh-pages [email protected]:pytorch/captum.git captum-gh-pages | ||
|
||
# A few notes about the script below: | ||
|
@@ -75,11 +75,11 @@ git clone --branch gh-pages [email protected]:pytorch/captum.git captum-gh-pages | |
# the site or the latest version. Instead, we determine this at runtime. | ||
# We use what's on gh-pages in the versions subdirectory as the | ||
# source of truth for available versions and use the latest tag on | ||
# the master branch as the source of truth for the latest version. | ||
# the main branch as the source of truth for the latest version. | ||
|
||
if [[ $VERSION == false ]]; then | ||
echo "-----------------------------------------" | ||
echo "Updating latest (master) version of site " | ||
echo "Updating latest (main) version of site " | ||
echo "-----------------------------------------" | ||
|
||
# Populate _versions.json from existing versions; this is used | ||
|
@@ -89,12 +89,12 @@ if [[ $VERSION == false ]]; then | |
CMD="import os, json; " | ||
CMD+="vs = [v for v in os.listdir('captum-gh-pages/versions') if v != 'latest' and not v.startswith('.')]; " | ||
CMD+="print(json.dumps(vs))" | ||
python3 -c "$CMD" > captum-master/website/_versions.json | ||
python3 -c "$CMD" > captum-main/website/_versions.json | ||
|
||
# Move versions.js to website subdirectory. | ||
# This is the page you see when click on version in navbar. | ||
cp captum-master/scripts/versions.js captum-master/website/pages/en/versions.js | ||
cd captum-master/website || exit | ||
cp captum-main/scripts/versions.js captum-main/website/pages/en/versions.js | ||
cd captum-main/website || exit | ||
|
||
# Build site, tagged with "latest" version; baseUrl set to /versions/latest/ | ||
yarn | ||
|
@@ -112,7 +112,7 @@ if [[ $VERSION == false ]]; then | |
cd "${WORK_DIR}" || exit | ||
cp captum-gh-pages/versions/latest/versions.html versions.html | ||
rm -rf captum-gh-pages/versions/latest | ||
mv captum-master/website/build/captum captum-gh-pages/versions/latest | ||
mv captum-main/website/build/captum captum-gh-pages/versions/latest | ||
# versions.html goes both in top-level and under en/ (default language) | ||
cp versions.html captum-gh-pages/versions/latest/versions.html | ||
cp versions.html captum-gh-pages/versions/latest/en/versions.html | ||
|
@@ -128,8 +128,8 @@ else | |
echo "Building new version ($VERSION) of site " | ||
echo "-----------------------------------------" | ||
|
||
# Checkout master branch with specified tag | ||
cd captum-master || exit | ||
# Checkout main branch with specified tag | ||
cd captum-main || exit | ||
git fetch --tags | ||
git checkout "${VERSION}" | ||
|
||
|
@@ -160,15 +160,15 @@ else | |
# Move built site to new folder (new-site) & carry over old versions | ||
# from existing gh-pages | ||
cd "${WORK_DIR}" || exit | ||
rm -rf captum-master/website/build/captum/docs/next # don't need this | ||
mv captum-master/website/build/captum new-site | ||
rm -rf captum-main/website/build/captum/docs/next # don't need this | ||
mv captum-main/website/build/captum new-site | ||
mv captum-gh-pages/versions new-site/versions | ||
|
||
# Build new version of site (to be placed in versions/$VERSION/) | ||
# the only thing that changes here is the baseUrl (for nav purposes) | ||
# we build this now so that in the future, we can just bump version and not move | ||
# previous stable to versions | ||
cd captum-master/website || exit | ||
cd captum-main/website || exit | ||
sed -i '' "s/baseUrl = '\/'/baseUrl = '\/versions\/${VERSION}\/'/g" siteConfig.js | ||
|
||
# disable search for non-stable version (can't use sed b/c of newline) | ||
|
@@ -188,14 +188,14 @@ else | |
# newer versions. This is the only part of the old versions that | ||
# needs to be updated when a new version is built. | ||
cd "${WORK_DIR}" || exit | ||
python3 captum-master/scripts/update_versions_html.py -p "${WORK_DIR}" | ||
python3 captum-main/scripts/update_versions_html.py -p "${WORK_DIR}" | ||
|
||
# Init as Git repo and push to gh-pages | ||
cd new-site || exit | ||
git init | ||
git add --all | ||
git commit -m "Publish version ${VERSION} of site" | ||
git push --force "https://github.com/pytorch/captum" master:gh-pages | ||
git push --force "https://github.com/pytorch/captum" main:gh-pages | ||
|
||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ function Versions(props) { | |
<tr> | ||
<td> | ||
{'latest'} | ||
{' (master)'} | ||
{' (main)'} | ||
</td> | ||
<td> | ||
<code> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters