-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try index.txt for viser docs version list, add version list banner cache
- Loading branch information
Showing
3 changed files
with
64 additions
and
13 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 |
---|---|---|
|
@@ -15,6 +15,8 @@ jobs: | |
steps: | ||
# Check out source. | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # This ensures the entire history is fetched so we can switch branches | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
|
@@ -42,6 +44,7 @@ jobs: | |
- name: Get version + subdirectory | ||
run: | | ||
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])") | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "DOCS_SUBDIR=versions/$VERSION" >> $GITHUB_ENV | ||
# Get version from pyproject.toml. | ||
|
@@ -60,3 +63,24 @@ jobs: | |
keep_files: false # This will only erase the destination subdirectory. | ||
cname: viser.studio | ||
if: github.event_name != 'pull_request' | ||
|
||
# We'll maintain an index of all versions under viser.studio/versions. | ||
# This will be useful for dynamically generating lists of possible doc links. | ||
- name: Update versions index.txt | ||
run: | | ||
git checkout . # Revert change to pyproject.toml from earlier... | ||
git checkout gh-pages | ||
git pull | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Brent Yi" | ||
FILE="versions/index.txt" # Replace with your file path | ||
if ! grep -qx "$VERSION" "$FILE"; then | ||
echo "$VERSION" >> "$FILE" | ||
git add $FILE | ||
git commit -m "Update versions.txt with new version $VERSION" | ||
git push origin gh-pages | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ env.VERSION }} | ||
if: github.event_name == 'push' # TODO: should be release. |
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