-
Notifications
You must be signed in to change notification settings - Fork 144
93 lines (86 loc) · 2.92 KB
/
Copy pathliara.yaml
File metadata and controls
93 lines (86 loc) · 2.92 KB
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
name: Deploy to Production
on:
push:
branches:
- master
pull_request:
branches: [main, master]
paths:
- "src/pages/**/*.mdx"
- "mdx-to-md-converter/**"
jobs:
generate-md:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install dependencies
run: |
npm ci
cd mdx-to-md-converter && npm ci
- name: Generate MD files
env:
MY_BASE_URL: ${{ secrets.MY_BASE_URL }}
MY_API_KEY: ${{ secrets.MY_API_KEY }}
run: |
echo "Repairing missing MD files only (no full rebuild)..."
npm --prefix mdx-to-md-converter run pre-commit -- --repair-missing
- name: Verify no diffs (PR only)
if: ${{ github.event_name == 'pull_request' }}
run: |
git add -A
if ! git diff --cached --quiet; then
echo "Generated MD is out of date. Run 'npm run generate-llms' and commit the results." >&2
exit 1
fi
- name: Check for changes (push only)
if: ${{ github.event_name == 'push' }}
id: check_changes
run: |
git diff --quiet public/llms public/all-links-llms.txt || echo "has_changes=true" >> $GITHUB_OUTPUT
- name: Commit and push if changed (push only)
if: ${{ github.event_name == 'push' && steps.check_changes.outputs.has_changes == 'true' }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add public/llms public/all-links-llms.txt
git commit -m "chore: auto-generate MD files from MDX [skip ci]"
git push
deploy:
runs-on: ubuntu-latest
needs: generate-md
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: install-dependencies
run: npm ci
- name: update-liara
env:
LIARA_TOKEN: ${{ secrets.IRAN_API_TOKEN }}
MY_BASE_URL: ${{ secrets.MY_BASE_URL }}
MY_API_KEY: ${{ secrets.MY_API_KEY }}
run: |
npm i -g @liara/cli@7
liara deploy --app="g2-the-docs" --api-token="$LIARA_TOKEN" --platform=docker --port=80 --no-app-logs --build-arg="MY_BASE_URL=$MY_BASE_URL" --build-arg="MY_API_KEY=$MY_API_KEY"
- name: Sleep for 60 seconds
run: sleep 60
shell: bash
- name: search-liara
working-directory: ./indexer
env:
MEILI_PRIVATE_KEY: ${{ secrets.MEILI_PRIVATE_KEY }}
MEILI_ROOT_URL: ${{ secrets.MEILI_ROOT_URL }}
run: |
npm i
npm run start