diff --git a/.github/utils/_repo.py b/.github/utils/_repo.py index ed901bf95..5ef0cf73d 100644 --- a/.github/utils/_repo.py +++ b/.github/utils/_repo.py @@ -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(): """ diff --git a/.github/utils/please.py b/.github/utils/please.py index cc466ba50..b3cf80036 100644 --- a/.github/utils/please.py +++ b/.github/utils/please.py @@ -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: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index ea7dff385..632729707 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -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 @@ -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 }}