Skip to content

Commit

Permalink
Use repos path
Browse files Browse the repository at this point in the history
  • Loading branch information
David Jackson authored and David Jackson committed Feb 1, 2022
1 parent 05b7a12 commit 6e45063
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,6 @@ ref/*

# Summary.md
SUMMARY.md

# used while building
repos/
27 changes: 13 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ inputs:
runs:
using: "composite"
steps:
# setup: checkout docugen tool and docs from github
- name: checkout docugen repo
uses: actions/checkout@v2
with:
repository: wandb/docugen
path: documentation/docugen
token: ${{ inputs.access-token }}
# # setup: checkout docugen tool and docs from github
# - name: checkout docugen repo
# uses: actions/checkout@v2
# with:
# repository: wandb/docugen
# path: documentation/docugen
# token: ${{ inputs.access-token }}
- name: checkout gitbook repo
uses: actions/checkout@v2
with:
repository: wandb/gitbook
path: documentation/gitbook
path: repos/gitbook
ref: ${{ inputs.gitbook-branch }}
token: ${{ inputs.access-token }}
# setup: bring in python plus the requirements for generating docs and the new release
Expand All @@ -34,24 +34,23 @@ runs:
shell: bash
env:
VERSION: latest
run: python -m pip install -r ./documentation/docugen/requirements.txt git+https://github.com/wandb/client.git@$VERSION
run: python -m pip install -r ./docugen/requirements.txt git+https://github.com/wandb/client.git@$VERSION

# generate the docs from the latest client library and overwrite gitbook contents
- name: generate documentation
shell: bash
working-directory: ./documentation/docugen
env:
VERSION: latest
run: python generate.py --template_file ../gitbook/SUMMARY.md --commit_id $VERSION --output_dir ../gitbook
run: python generate.py --template_file ./repos/gitbook/SUMMARY.md --commit_id $VERSION --output_dir ../gitbook
# for debugging/tracking, display the generated table of contents
- name: display ToC
shell: bash
run: cat ./documentation/gitbook/SUMMARY.md
run: cat ./repos/gitbook/SUMMARY.md

# stage: commit the changes
- name: commit changes
shell: bash
working-directory: ./documentation/gitbook
working-directory: ./repos/gitbook
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
Expand All @@ -61,7 +60,7 @@ runs:
# deploy: push to the gitbook repository
- name: push
shell: bash
working-directory: ./documentation/gitbook
working-directory: ./repos/gitbook
run: |
git remote set-url origin [email protected]:wandb/gitbook.git
git push
35 changes: 17 additions & 18 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,23 @@ def check_commit_id(commit_id):
Args:
commit_id: The commit id provided
"""
pass
# if commit_id == "latest":
# # using latest version instead of a commit id -- this should work as long as
# # we aren't hosting legacy doc versions -- if we do, we'll need to go back
# # to passing an actual id
# pass
# elif "." in commit_id:
# # commit_id is a version
# wandb_version = f"v{wandb.__version__}"
# assert (
# wandb_version == commit_id
# ), f"git version {commit_id} does not match wandb version {wandb_version}"
# else:
# # commit_id is a git hash
# commit_id_len = len(commit_id)
# assert (
# commit_id_len == 40
# ), f"git hash must have all 40 characters, was {commit_id}"
if commit_id == "latest":
# using latest version instead of a commit id -- this should work as long as
# we aren't hosting legacy doc versions -- if we do, we'll need to go back
# to passing an actual id
pass
elif "." in commit_id:
# commit_id is a version
wandb_version = f"v{wandb.__version__}"
assert (
wandb_version == commit_id
), f"git version {commit_id} does not match wandb version {wandb_version}"
else:
# commit_id is a git hash
commit_id_len = len(commit_id)
assert (
commit_id_len == 40
), f"git hash must have all 40 characters, was {commit_id}"


if __name__ == "__main__":
Expand Down

0 comments on commit 6e45063

Please sign in to comment.