-
Notifications
You must be signed in to change notification settings - Fork 2.1k
82 lines (78 loc) · 2.82 KB
/
label-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: PR
on:
pull_request:
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 '::set-output name=docs::true'
outputs:
docs: ${{ steps.docs_updated.outputs.docs }}
deploy-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/clip-as-service
ref: ${{ env.BRANCH_NAME }}
- uses: actions/setup-python@v2
with:
python-version: 3.7
- 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_TOKEN1 }}
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: