diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 64f2debacbd..1853247e9f9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -143,3 +143,32 @@ jobs: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} JINA_SLACK_WEBHOOK: ${{ secrets.JINA_SLACK_WEBHOOK }} + + check-readme-modification: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get changed files + id: changed-files-specific + uses: tj-actions/changed-files@v34 + with: + files: | + README.md + + - name: Check if README is modified + if: steps.changed-files-specific.outputs.any_changed == 'true' + run: | + echo "README.md is modified" + touch SUCCESS + + - name: Return outputs + run: | + [[ -f SUCCESS ]] + + publish-docarray-org: + needs: check-readme-modification + uses: ./.github/workflows/publish-docarray-org.yml + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/publish-docarray-org.yml b/.github/workflows/publish-docarray-org.yml new file mode 100644 index 00000000000..8e52c03fa7f --- /dev/null +++ b/.github/workflows/publish-docarray-org.yml @@ -0,0 +1,60 @@ +name: Manual Publish DocArray[dot]org + +on: + workflow_dispatch: + inputs: + release_token: + description: 'Your release token' + required: true + workflow_call: + secrets: + JINA_DEV_BOT: + required: True + +# uncomment this line for testing in PR +# push: + +jobs: + token-check: + runs-on: ubuntu-latest + steps: + - name: debug + run: | + echo ${{ github.event_name }} event triggered this action + - name: Check release token + id: token-check + run: | + touch SUCCESS + if: inputs.release_token == env.release_token + env: + release_token: ${{ secrets.DOCARRAY_RELEASE_TOKEN }} + - name: Check trigger event + run: | + touch SUCCESS + if: github.event_name == 'pull_request' + - name: Fail release token + run: | + [[ -f SUCCESS ]] + + copy-readme: + needs: token-check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + path: docarray + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + repository: docarray/docarray.github.io + path: docarray.github.io + token: ${{ secrets.JINA_DEV_BOT }} + - name: Check out DocArray page + run: | + cd ${GITHUB_WORKSPACE}/docarray.github.io + cp ${GITHUB_WORKSPACE}/docarray/README.md . + git config --local user.email "Jina Dev Bot" + git config --local user.name "dev-bot@jina.ai" + git add README.md && git commit -s -m "chore(docs): sync up README from docarray" + git push diff --git a/README.md b/README.md index 4da6e9d6488..b9c7aaa1f3a 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ The following news article card can be easily represented via `docarray.dataclas
+