Skip to content

fix: workflow

fix: workflow #1305

Workflow file for this run

name: Trigger milvus.io production build
on:
repository_dispatch:
types: [prod-deploy]
push:
paths-ignore:
- "preview/**.md"
workflow_dispatch:
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: $(( ${{ github.event_name == 'pull_request' && github.event.pull_request.commits || 0 }} + 1 ))
- name: Set Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Yarn install
uses: borales/actions-yarn@v4
with:
cmd: install
- name: Check for new files
id: check-new-files
run: |
new_files=$(git diff --name-status HEAD~1 HEAD | grep '^A' | awk '{print $2}' | grep '^v2\.4\.x/.*\.md$')
if [ -z "$new_files" ]; then
echo "No new files detected."
echo "::set-output name=new_files_detected::false"
else
echo "New files detected: $new_files"
echo "::set-output name=new_files_detected::true"
fi
- name: Generate EN Docs
run: |
git config --global user.email "[email protected]"
git config --global user.name "Milvus-doc-bot"
yarn generate:en
- name: Run translate if new files detected
if: steps.check-new-files.outputs.new_files_detected == 'true'
run: |
echo "New file detected, running script..."
touch .env
echo DEEPL_API_KEY=${{secrets.DEEPL_API_KEY}} >> .env
echo GITHUB_TOKEN=${{secrets.GH_TOKEN}} >> .env
yarn translate
- name: Commit and push
run: |
git config --global user.email "[email protected]"
git config --global user.name "Milvus-doc-bot"
git add .
git commit -m "Generate en docs"
git push -f origin master
continue-on-error: true
- name: Trigger milvus.io
run: |
curl -XPOST -H "Authorization: Bearer ${{secrets.GH_TOKEN}}" https://api.github.com/repos/milvus-io/milvus.io/dispatches -d '{"event_type": "prod-deploy"}'