upstream merge #1
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: PR | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| assign-label-to-pr: | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| steps: | |
| - uses: codelytv/pr-size-labeler@v1 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| xs_max_size: '10' | |
| s_max_size: '100' | |
| m_max_size: '500' | |
| l_max_size: '1000' | |
| fail_if_xl: 'false' | |
| - uses: actions/labeler@v3 | |
| with: | |
| repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
| - id: docs_updated | |
| if: contains( github.event.pull_request.labels.*.name, 'area/docs') | |
| run: echo "docs=true" >> $GITHUB_OUTPUT | |
| outputs: | |
| docs: ${{ steps.docs_updated.outputs.docs }} | |
| deploy-to-netlify: | |
| runs-on: ubuntu-latest | |
| needs: [assign-label-to-pr] | |
| steps: | |
| - run: | | |
| echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV | |
| - uses: actions/[email protected] | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.8 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: '14' | |
| - name: Build and Deploy | |
| run: | | |
| npm i -g netlify-cli | |
| python -m pip install --upgrade pip | |
| python -m pip install poetry==1.7.1 | |
| python -m poetry config virtualenvs.create false && python -m poetry install --no-interaction --no-ansi --all-extras | |
| cd docs | |
| bash makedocs.sh | |
| cd .. | |
| netlify deploy --dir=site --alias="ft-${{ env.BRANCH_NAME }}" --message="Deploying docs to ${{ env.BRANCH_NAME }} branch" | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN1 }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| - name: Find the prev comment if exists | |
| uses: peter-evans/find-comment@v1 | |
| id: fc | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: 'Docs are deployed' | |
| - name: Delete comment if exists | |
| if: ${{ steps.fc.outputs.comment-id != 0 && !github.event.pull_request.head.repo.fork }} | |
| uses: actions/github-script@v3 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| github.issues.deleteComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: ${{ steps.fc.outputs.comment-id }}, | |
| }) | |
| - name: Add or update comment | |
| uses: peter-evans/create-or-update-comment@v1 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| :memo: Docs are deployed on https://ft-${{ env.BRANCH_NAME }}--jina-docs.netlify.app :tada: |