Skip to content

Commit

Permalink
CI: Deploy release docs to (pre)website branch
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Feb 20, 2024
1 parent cd1b2a0 commit fbcadb1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .github/utils/_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ def is_release():
ref_type = os.environ.get("GITHUB_REF_TYPE", "")
return ref_type == "tag" and bool(RELEASE_TAG_PATTERN.match(ref))

@staticmethod
def is_pre_release():
"""
Return True if event is a release
"""
ref = os.environ.get("GITHUB_REF_NAME", "")
ref_type = os.environ.get("GITHUB_REF_TYPE", "")
return ref_type == "tag" and bool(PRE_RELEASE_TAG_PATTERN.match(ref))

@staticmethod
def branch():
"""
Expand Down
5 changes: 4 additions & 1 deletion .github/utils/please.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def where_can_i_deploy_documentation() -> str:
"""
if Git.is_release():
return "website"
return "gh-pages" if Git.branch() == "main" else "gh-pages"
elif Git.is_pre_release():
return "pre-website"
else:
return "gh-pages"


def process_request(arg: str) -> str:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
- name: Install Package
shell: bash
run: |
pip install git+https://github.com/has2k1/mizani.git@main
pip install git+https://github.com/has2k1/quartodoc.git@main
python -m pip install ".[doc]"
pip install -r requirements/doc.txt
Expand All @@ -82,9 +81,11 @@ jobs:
ls -la doc/reference/examples
ls -la doc/tutorials
- name: Deploy to Github Pages
- name: Deploy to Documentation to a Branch
uses: JamesIves/github-pages-deploy-action@v4
if: contains(needs.parse_commit_info.outputs.can_deploy, 'true')
if: github.ref == "refs/heads/main" || github.ref == "refs/heads/dev"
with:
folder: doc/_site
branch: ${{ needs.parse_commit_info.outputs.deploy_to }}
commit-message: ${{ github.event.head_commit.message }}

0 comments on commit fbcadb1

Please sign in to comment.