-
Notifications
You must be signed in to change notification settings - Fork 2.2k
103 lines (98 loc) · 3.74 KB
/
cd.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
name: CD
on:
push:
branches:
- master
#on:
# push:
# branches-ignore:
# - '**' # temporally ignore all
jobs:
update-doc:
if: "!startsWith(github.event.head_commit.message, 'chore')"
runs-on: ubuntu-latest
steps:
- uses: technote-space/toc-generator@v2
with:
MAX_HEADER_LEVEL: 2
FOLDING: false
GITHUB_TOKEN: ${{ secrets.JINA_DEV_BOT }}
TOC_TITLE: ''
TARGET_PATHS: 'README.md, CHANGELOG.md, CONTRIBUTING.md'
COMMIT_MESSAGE: 'chore(docs): update TOC'
# - uses: peter-evans/dockerhub-description@v2.1.0
# env:
# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_DEVBOT_USER }}
# DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_DEVBOT_PWD }}
# DOCKERHUB_REPOSITORY: jinaai/jina
- uses: actions/checkout@v2
with:
token: ${{ secrets.JINA_DEV_BOT }}
- run: |
git fetch --prune --unshallow
git config --local user.email "dev-bot@jina.ai"
git config --local user.name "Jina Dev Bot"
- uses: VinnyBabuManjaly/copyright-action@v1.0.0
with:
CopyrightString: '__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."\n__license__ = "Apache-2.0"\n\n'
FileType: '.py'
Path: 'jina/'
- run: |
git add -u
git commit -m "chore: update copyright header"
git status
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.JINA_DEV_BOT }}
force: true
- uses: actions/setup-python@v1
with:
python-version: 3.7
- run: |
pip install .
echo ::set-env name=JINA_VERSION::"$(sed '3q;d' ./jina/__init__.py | cut -d \' -f2)-devel"
- name: make doc
run: |
jina check
./make-doc.sh commit "update ${{env.JINA_VERSION}} due to ${{github.event_name}} on ${{github.repository}}"
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.JINA_DEV_BOT }}
repository: jina-ai/jina-docs
directory: docs/_build/html
force: true
update-docker:
needs: update-doc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Set envs and versions
run: |
echo ${{ steps.buildx.outputs.platforms }}
echo ::set-env name=VCS_REF::$(git rev-parse --short HEAD)
echo ::set-env name=BUILD_DATE::$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo ::set-env name=JINA_VERSION::"$(sed '3q;d' ./jina/__init__.py | cut -d \' -f2)-devel"
- name: Run Buildx and Upload to Docker Cloud
run: |
docker login -u ${{ secrets.DOCKERHUB_DEVBOT_USER }} -p ${{ secrets.DOCKERHUB_DEVBOT_TOKEN }}
docker buildx build \
--platform linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 \
--output "type=registry" \
--build-arg VCS_REF --build-arg BUILD_DATE --build-arg JINA_VERSION \
-t jinaai/jina:devel -t jinaai/jina:${{env.JINA_VERSION}} \
--file ./Dockerfiles/debianx.Dockerfile .
- name: Upload to Github Docker Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: jina-ai/jina/jina
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: docker.pkg.github.com
dockerfile: Dockerfiles/debianx.Dockerfile
buildargs: BUILD_DATE, VCS_REF, JINA_VERSION
tags: "devel, ${{env.JINA_VERSION}}"