Merge pull request #162 from secure-software-engineering/unifyToString #209
This file contains hidden or 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: Deploy Documentation | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| paths: | |
| - 'mkdocs.yml' | |
| - 'docs/**' | |
| - '.github/worklflows/gh-pages.yml' | |
| pull_request_target: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - closed | |
| paths: | |
| - 'mkdocs.yml' | |
| - 'docs/**' | |
| - '.github/worklflows/gh-pages.yml' | |
| concurrency: pages | |
| permissions: | |
| pages: write | |
| deployments: write | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| manage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.x | |
| - name: Install Dependencies | |
| run: pip install mike mkdocs-material mkdocs-tooltips git+https://github.com/RedisLabs/mkdocs-include.git git+https://github.com/swissiety/LspLexer4Pygments.git | |
| # Sanitize head_ref name | |
| - run: echo "DOC_VERSION_NAME=$(echo ${{ github.head_ref }} | sed "s/[^a-zA-Z0-9._-]/_/g" )" >> $GITHUB_ENV | |
| # on PR events.. | |
| - name: Deploy Doc in Subdirectory | |
| if: startsWith(github.event_name, 'pull_request') | |
| run: mike deploy ${{ env.DOC_VERSION_NAME }}_preview -t "PR Preview ${{ env.DOC_VERSION_NAME }}" --push && mike props ${{ env.DOC_VERSION_NAME }}_preview --set-string hidden=true --push | |
| - name: Comment Link to Preview | |
| if: startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| message: | | |
| [Documentation Preview](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.DOC_VERSION_NAME }}_preview/). | |
| # on PR close - delete preview | |
| - name: Delete the Deployed Preview | |
| if: startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' | |
| run: mike delete ${{ env.DOC_VERSION_NAME }}_preview --push | |
| - name: Deploy to GitHub Pages | |
| if: github.event_name == 'push' && github.base_ref == 'develop' | |
| run: mike deploy develop --push --update-aliases develop latest | |
| - name: Deploy Doc Version for New Release | |
| if: github.event_name == 'push' && github.base_ref == 'master' | |
| run: mike deploy "$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed "s/[^a-zA-Z0-9._-]/_/g" )" --push |