forked from rlberry-py/rlberry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit squashes everything that was used to setup the new docume…
…ntation workflow with github page.
- Loading branch information
1 parent
3669911
commit 47f6d06
Showing
16 changed files
with
259 additions
and
38 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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: documentation_stable | ||
on: | ||
workflow_run: | ||
workflows: ["documentation_dev"] | ||
types: | ||
- completed | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
path: main | ||
- name: checkout latest | ||
run: | | ||
cd main | ||
git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) | ||
cd .. | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
pip install -r main/docs/requirements.txt | ||
pip install -r main/requirements.txt | ||
- name: Sphinx build | ||
run: | | ||
sphinx-build main/docs _build | ||
- uses: actions/checkout@v4 | ||
with: | ||
# This is necessary so that we have the tags. | ||
fetch-depth: 0 | ||
ref: gh-pages | ||
path: gh_pages | ||
- name: Commit documentation changes | ||
run: | | ||
cd gh_pages | ||
rm -r stable || echo "Ignoring exit status" | ||
mkdir stable | ||
cp -rv ../_build/* stable | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "Documentation Stable" | ||
git push |
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: "preview" | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["ready_for_review"] | ||
types: | ||
- completed | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: Download workflow artifact | ||
uses: dawidd6/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: peek_icons.yml | ||
run_id: ${{ github.event.workflow_run.id }} | ||
|
||
- name: Read the pr_num file | ||
id: pr_num_reader | ||
uses: juliangruber/[email protected] | ||
with: | ||
path: ./pr_num/pr_num.txt | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: main | ||
- name: Checkout Pull Request | ||
env: | ||
GITHUB_USER: ${{ secrets.GITHUB_USER }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cd main | ||
gh pr checkout ${{ steps.pr_num_reader.outputs.content }} | ||
cd .. | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
set +e | ||
pip install -r main/docs/requirements.txt | ||
pip install -r main/requirements.txt | ||
sphinx-build main/docs _build | ||
echo "exitcode=$?" >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
with: | ||
# This is necessary so that we have the tags. | ||
fetch-depth: 0 | ||
ref: gh-pages | ||
path: gh_pages | ||
|
||
- name: Commit documentation changes | ||
if: ${{ env.exitcode == 0 }} | ||
run: | | ||
cd gh_pages | ||
rm -r preview_pr || echo "Ignoring exit status" | ||
mkdir preview_pr | ||
cp -rv ../_build/* preview_pr | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "Preview documentation" | ||
git push | ||
- name: Comment on the PR about the result | ||
uses: jungwinter/comment@v1 # let us comment on a specific PR | ||
if: ${{ env.exitcode == 0 }} | ||
env: | ||
MESSAGE: | | ||
Hello, | ||
The build of the doc succeeded. The documentation preview is available here: | ||
https://rlberry-py.github.io/rlberry/preview_pr | ||
with: | ||
type: create | ||
issue_number: ${{ steps.pr_num_reader.outputs.content }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: > | ||
${{ format(env.MESSAGE, | ||
fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0], | ||
join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '')) }} | ||
- name: Comment on the PR about the result, fail | ||
uses: jungwinter/comment@v1 # let us comment on a specific PR | ||
if: ${{ env.exitcode != 0 }} | ||
env: | ||
MESSAGE: | | ||
Hello, | ||
The build of the doc failed. Look up the reason here: | ||
https://github.com/rlberry-py/rlberry/actions/workflows/preview.yml | ||
with: | ||
type: create | ||
issue_number: ${{ steps.pr_num_reader.outputs.content }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: > | ||
${{ format(env.MESSAGE, | ||
fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0], | ||
join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '')) }} | ||
- name: Exit | ||
run: exit "$exitcode" |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: ready_for_review | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, opened, reopened, synchronize] | ||
|
||
jobs: | ||
build: | ||
if: contains( github.event.pull_request.labels.*.name, 'ready for review') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run a one-line script | ||
run: echo ready for review! | ||
- name: Save the PR number in an artifact | ||
shell: bash | ||
env: | ||
PR_NUM: ${{ github.event.number }} | ||
run: echo $PR_NUM > pr_num.txt | ||
|
||
- name: Upload the PR number | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: pr_num | ||
path: ./pr_num.txt |
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
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
Oops, something went wrong.