English translation yolox l #1
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
name: Pull request comment | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
test-doc-generator-by-pr-number: | |
if: (contains(github.event.comment.html_url, '/pull/') && startsWith(github.event.comment.body, '/gen-doc')) | |
runs-on: [ubuntu-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: refs/pull/${{ github.event.issue.number }}/head | |
path: sdk | |
- name: Checkout docs repo | |
uses: actions/checkout@v3 | |
with: | |
repository: furiosa-ai/docs-dev | |
token: ${{ secrets.GH_PAT }} | |
path: docs | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: make docs | |
env: | |
BODY: ${{ github.event.comment.body }} | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
ISSUE: ${{ github.event.issue.html_url }} | |
ISSUE_NUMBER: ${{ github.event.issue.number }} | |
run: | | |
cd ./sdk | |
export GIT_HASH=$(git rev-parse --short HEAD) | |
export ISSUE_URL=$(echo $ISSUE | cut -d'/' -f-5) | |
export DOCS_VERSION="PR-$ISSUE_NUMBER" | |
echo "Git short hash: $GIT_HASH" | |
echo "Documentation version: $DOCS_VERSION" | |
echo "Issue URL base: $ISSUE_URL" | |
# clear existing doc | |
cd ../docs | |
rm -rf $DOCS_VERSION | |
# install documentation requirements | |
cd ../sdk/docs | |
pip install -r ./requirements.txt | |
# generate documentation | |
DOCS_PATH=../../docs make html deploy | |
# make docs-dev commit | |
cd ../../docs | |
git add . | |
# if no change in docs repo | |
if git diff --cached --exit-code > /dev/null; then exit 1; fi | |
git config user.email "[email protected]" | |
git config user.name "furiosa-infra" | |
git commit -m "docs: auto generated by furiosa-sdk-private#$ISSUE_NUMBER | |
related commit: $ISSUE_URL/commit/$GIT_HASH" | |
export DOCS_COMMIT=$(git rev-parse --short HEAD) | |
git push | |
# if we run `gh run list` right after push, we'll miss the latest commit | |
sleep 5 | |
export RUN_ID=$(gh run list | head -n 1 | grep -Po "[\d]{10}") | |
echo "RUN_ID: $RUN_ID" | |
gh run watch $RUN_ID | |
# github comment | |
cd ../sdk | |
gh issue comment -R $ISSUE_URL $ISSUE_NUMBER --body "Documentation generated by $DOCS_VERSION successfully! | |
furiosa-ai/docs-dev commit: https://github.com/furiosa-ai/docs-dev/commit/$DOCS_COMMIT | |
English doc URL: https://furiosa-ai.github.io/docs-dev/$DOCS_VERSION/en | |
Korean doc URL: https://furiosa-ai.github.io/docs-dev/$DOCS_VERSION/ko" | |
release-doc-generator-by-given-version: | |
if: (contains(github.event.comment.html_url, '/pull/') && startsWith(github.event.comment.body, '/release-doc')) | |
runs-on: [ubuntu-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: refs/pull/${{ github.event.issue.number }}/head | |
path: sdk | |
- name: Checkout docs repo | |
uses: actions/checkout@v3 | |
with: | |
repository: furiosa-ai/docs | |
token: ${{ secrets.GH_PAT }} | |
path: docs | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: make docs | |
env: | |
BODY: ${{ github.event.comment.body }} | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
ISSUE: ${{ github.event.issue.html_url }} | |
ISSUE_NUMBER: ${{ github.event.issue.number }} | |
run: | | |
cd ./sdk | |
export GIT_HASH=$(git rev-parse --short HEAD) | |
export ISSUE_URL=$(echo $ISSUE | cut -d'/' -f-5) | |
export DOCS_VERSION=$(echo $BODY | head -n 1 | cut -d'/' -f3) | |
echo "Git short hash: $GIT_HASH" | |
echo "Documentation version: $DOCS_VERSION" | |
echo "Issue URL base: $ISSUE_URL" | |
if [ ! $(echo "$DOCS_VERSION" | grep -P "v([0-9]+\.){2}[0-9]+") ]; then | |
gh issue comment -R $ISSUE_URL $ISSUE_NUMBER --body "Docs version is malformed, it should be v\d+\.\d+\.\d+ format"; | |
exit 1; | |
fi | |
# clear existing doc | |
cd ../docs | |
git log | |
rm -rf $DOCS_VERSION | |
# install furiosa-sdk to make api reference | |
make -C ../sdk/python install | |
cd ../sdk/docs | |
pip install -r ./requirements.txt | |
# generate documentation | |
DOCS_PATH=../../docs/ make html deploy | |
# show git status | |
cd ../../docs | |
git add . | |
if git diff --cached --exit-code > /dev/null; then exit 1; fi | |
git config user.email "[email protected]" | |
git config user.name "furiosa-infra" | |
git commit -m "docs: auto generated by furiosa-sdk-private#$ISSUE_NUMBER | |
related commit: $ISSUE_URL/commit/$GIT_HASH" | |
export DOCS_COMMIT=$(git rev-parse --short HEAD) | |
git push | |
# if we run `gh run list` right after push, we'll miss the latest commit | |
sleep 5 | |
export RUN_ID=$(gh run list | head -n 1 | grep -Po "[\d]{10}") | |
echo "RUN_ID: $RUN_ID" | |
gh run watch $RUN_ID | |
# github comment | |
cd ../sdk | |
gh issue comment -R $ISSUE_URL $ISSUE_NUMBER --body "Documentation for release generated by $DOCS_VERSION successfully! | |
furiosa-ai/docs commit: https://github.com/furiosa-ai/docs/commit/$DOCS_COMMIT | |
English doc URL: https://furiosa-ai.github.io/docs/$DOCS_VERSION/en | |
Korean doc URL: https://furiosa-ai.github.io/docs/$DOCS_VERSION/ko" |