This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
docs: add tiny model #1376
Workflow file for this run
This file contains 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: | |
jobs: | |
assign-label-to-pr: | |
name: 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 '::set-output name=docs::true' | |
outputs: | |
docs: ${{ steps.docs_updated.outputs.docs }} | |
deploy-to-netlify: | |
name: Deploy docs to netlify | |
runs-on: ubuntu-latest | |
needs: assign-label-to-pr | |
if: ${{ needs.assign-label-to-pr.outputs.docs == 'true' }} | |
steps: | |
- run: | | |
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v2 | |
with: | |
repository: jina-ai/finetuner | |
ref: ${{ env.BRANCH_NAME }} | |
- uses: actions/setup-python@v2 | |
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 | |
pip install -r requirements.txt | |
git fetch origin | |
export NUM_RELEASES=2 # only 2 last tags to save build time | |
bash makedoc.sh development | |
netlify deploy --dir=_build/dirhtml --alias="ft-${{ env.BRANCH_NAME }}" --message="Deploying docs to ${{ env.BRANCH_NAME }} branch" | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
working-directory: docs | |
- 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: |