forked from jina-ai/serve
-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (187 loc) · 7.53 KB
/
tag.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Release CD
on:
push:
tags:
- "v*" # push to version tags trigger the build
jobs:
update-schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/checkout@v2
with:
repository: jina-ai/api
path: schema
token: ${{ secrets.JINA_DEV_BOT }}
- uses: actions/setup-python@v2
with:
python-version: 3.7
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: |
JINA_VERSION=${GITHUB_REF/refs\/tags\/v/}
JINA_MINOR_VERSION=${JINA_VERSION%.*}
V_JINA_VERSION=${GITHUB_REF/refs\/tags\//}
echo "JINA_VERSION=${JINA_VERSION}" >> $GITHUB_ENV
echo "V_JINA_VERSION=${V_JINA_VERSION}" >> $GITHUB_ENV
echo "JINA_MINOR_VERSION=${JINA_MINOR_VERSION}" >> $GITHUB_ENV
pip install .[daemon] --no-cache-dir
cd schema
mkdir -p schemas
jina export-api --schema-path schemas/"$JINA_VERSION.json" schemas/latest.json schemas/latest --yaml-path "$JINA_VERSION.yml" latest.yml --json-path "$JINA_VERSION.json" latest.json latest
python ../scripts/get-openapi-schemas.py
npm install --prefix ~ snippet-enricher-cli
~/node_modules/.bin/snippet-enricher-cli --input=gateway.json --targets=shell_curl > gateway-with-code.json
~/node_modules/.bin/snippet-enricher-cli --input=daemon.json --targets=shell_curl > daemon-with-code.json
cd -
- name: redoc-cli-jinad
uses: seeebiii/redoc-cli-github-action@v10
with:
args: 'bundle schema/daemon-with-code.json -o jinad.html'
- name: redoc-cli-gateway
uses: seeebiii/redoc-cli-github-action@v10
with:
args: 'bundle schema/gateway-with-code.json -o rest.html'
- name: push-to-api-repo
run: |
mkdir -p schema/daemon/
cp jinad.html schema/daemon/index.html
cp jinad.html schema/daemon/${{env.JINA_VERSION}}.html
rm schema/daemon.json schema/daemon-with-code.json
rm -rf schema/jinad
mkdir -p schema/rest/
cp rest.html schema/rest/index.html
cp rest.html schema/rest/${{env.JINA_VERSION}}.html
rm schema/gateway.json schema/gateway-with-code.json
cd schema
git config --local user.email "[email protected]"
git config --local user.name "Jina Dev Bot"
git add . && git commit -m "update ${{env.JINA_VERSION}} due to ${{github.event_name}} on ${{github.repository}}" && git push
update-dashboard-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
JINA_VERSION=${GITHUB_REF/refs\/tags\/v/}
echo "JINA_VERSION=${JINA_VERSION}" >> $GITHUB_ENV
- name: Dashboard version update
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Sync version with Jina core
repo: jina-ai/dashboard
token: ${{ secrets.JINA_DEV_BOT }}
ref: refs/heads/master
inputs: '{ "version": "${{ env.JINA_VERSION }}" }'
deploy-jinad-cloud-jina-ai:
runs-on: ubuntu-latest
steps:
- uses: benc-uk/workflow-dispatch@v1
with:
workflow: Destroy previous & Deploy new JinaD
repo: jina-ai/jina-terraform
token: ${{ secrets.JINA_DEV_BOT }}
ref: refs/heads/main
inputs: '{ "TFID": "cloud.jina.ai", "instance_type": "t2.micro", "region": "us-east-1", "cloudflare_record_name": "cloud" }'
update-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: 3.7
- id: get_version
run: |
echo ::set-output name=JINA_VERSION::${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=V_JINA_VERSION::${GITHUB_REF/refs\/tags\//}
# Tell docs repo jina is going to release
- name: send-repository-dispatch-event-to-docs
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.JINA_DEV_BOT }}
repository: jina-ai/docs
event-type: jina-release-event
update-docker:
needs: update-doc
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tag_stage: ["", "-devel", "-daemon"]
tag_pyversion: ["-py37", "-py38", "-py39"]
steps:
- uses: actions/checkout@v2
- name: Set envs and versions
run: |
echo "VCS_REF=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
echo "JINA_VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
echo "V_JINA_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
JINA_VERSION=${GITHUB_REF/refs\/tags\/v/}
JINA_MINOR_VERSION=${JINA_VERSION%.*}
echo "JINA_MINOR_VERSION=${JINA_MINOR_VERSION}" >> $GITHUB_ENV
if [[ "${{ matrix.tag_pyversion }}" == "-py38" ]]; then
echo "PY_VERSION=3.8" >> $GITHUB_ENV
elif [[ "${{ matrix.tag_pyversion }}" == "-py39" ]]; then
echo "PY_VERSION=3.9" >> $GITHUB_ENV
else
echo "PY_VERSION=3.7" >> $GITHUB_ENV
echo "TAG_ALIAS=jinaai/jina:latest${{ matrix.tag_stage }}, jinaai/jina:$JINA_VERSION${{ matrix.tag_stage }}, jinaai/jina:$JINA_MINOR_VERSION${{ matrix.tag_stage }}" >> $GITHUB_ENV
fi
if [[ "${{ matrix.tag_stage }}" == "-daemon" ]]; then
echo "BUILD_ARG=jina_daemon" >> $GITHUB_ENV
elif [[ "${{ matrix.tag_stage }}" == "-devel" ]]; then
echo "BUILD_ARG=jina_devel" >> $GITHUB_ENV
else
echo "BUILD_ARG=jina_base" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_DEVBOT_USER }}
password: ${{ secrets.DOCKERHUB_DEVBOT_TOKEN }}
- run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/debianx.Dockerfile
platforms: linux/armhf,linux/amd64,linux/arm/v6
push: true
tags: jinaai/jina:latest${{ matrix.tag_pyversion }}${{ matrix.tag_stage }}, jinaai/jina:${{env.JINA_VERSION}}${{ matrix.tag_pyversion }}${{ matrix.tag_stage }}, jinaai/jina:${{env.JINA_MINOR_VERSION}}${{ matrix.tag_pyversion }}${{ matrix.tag_stage }}, ${{env.TAG_ALIAS}}
build-args: BUILD_DATE, JINA_VERSION, VCS_REF, PY_VERSION
target: ${{env.BUILD_ARG}}
create-release:
needs: update-doc
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: 'master'
- uses: actions/setup-python@v2
with:
python-version: 3.7
- run: |
python scripts/get-last-release-note.py
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: 💫 Patch ${{ github.ref }}
body_path: 'tmp.md'
draft: false
prerelease: false