docs build on develop for branches with name docs/* (#4821)

This commit is contained in:
Luqman
2023-04-18 17:58:38 +01:00
committed by GitHub
parent dceaabcf53
commit f34da04d10
2 changed files with 19 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ jobs:
- name: Check branch name for develop PRs
if: ${{ steps.branch-name-check.outputs.target-branch == 'develop' }}
run: |
if [[ "${{ steps.branch-name-check.outputs.source-branch }}" =~ ^(main|feature/.*|hotfix/.*|release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?)$ ]]; then
if [[ "${{ steps.branch-name-check.outputs.source-branch }}" =~ ^(main|feature/.*|docs/.*|hotfix/.*|release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?)$ ]]; then
echo "Branch name is valid"
else
echo "Invalid branch name. Branches must follow the GitFlow naming convention to be allowed to merge into the develop branch."

View File

@@ -5,10 +5,22 @@ on:
branches:
- main
- release/*
pull_request:
types: [closed]
branches:
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate:
name: Generate and Deploy documentation
if: >
github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
startsWith(github.head_ref, 'docs/'))
runs-on: ubuntu-latest
steps:
- name: Git checkout
@@ -73,7 +85,12 @@ jobs:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: startsWith(github.ref, 'refs/heads/main')
if: >
(startsWith(github.ref, 'refs/heads/main')) ||
(github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == 'develop' &&
startsWith(github.head_ref, 'docs/'))
with:
github_token: ${{ secrets.DEPLOY_TOKEN }}
publish_dir: ./website/build