-
Notifications
You must be signed in to change notification settings - Fork 6
79 lines (71 loc) · 2.58 KB
/
docs.yaml
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
name: Update docs
on:
push:
branches:
- main
paths:
- ".github/workflows/docs.yaml"
- "README.md"
- "docs/**"
jobs:
update-docs:
runs-on: ubuntu-latest
environment:
name: docs
url: https://docs.victoriametrics.com/
steps:
- name: Check out code
uses: actions/checkout@v4
with:
repository: VictoriaMetrics/victorialogs-datasource
ref: main
token: ${{ secrets.VM_BOT_GH_TOKEN }}
path: "__vm-datasource-repo"
- name: Check out VM code
uses: actions/checkout@v4
with:
repository: VictoriaMetrics/VictoriaMetrics
ref: master
token: ${{ secrets.VM_BOT_GH_TOKEN }}
path: "__vm-docs-repo"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.VM_BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.VM_BOT_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
workdir: "__vm-docs-repo"
# Copies README.md and assets from docs/assets
- name: Update ds docs in VM repo
run: |
sed -i '/VictoriaLogs datasource for Grafana/g' README.md
echo '---
weight: 9
title: Grafana datasource
editLink: https://github.com/VictoriaMetrics/victorialogs-datasource/blob/main/README.md
menu:
docs:
identifier: victorialogs-grafana-datasource
parent: 'victorialogs'
weight: 9
aliases:
- /victorialogs/victorialogs-datasource.html
---
' > ../__vm-docs-repo/docs/VictoriaLogs/victorialogs-datasource.md
cat ./README.md >> ../__vm-docs-repo/docs/VictoriaLogs/victorialogs-datasource.md
sed -i 's|docs/assets/||g' ../__vm-docs-repo/docs/VictoriaLogs/victorialogs-datasource.md
cp docs/assets/* ../__vm-docs-repo/docs/VictoriaLogs/
working-directory: "__vm-datasource-repo"
- name: Commit and push changes
run: |
export VM_GIT_BRANCH_NAME="ds-docs-update-$(date +%s)"
export VM_GIT_COMMIT_SHA="$(git rev-parse --short $GITHUB_SHA)"
git checkout -b "${VM_GIT_BRANCH_NAME}"
git add docs/
git commit -S -m "Automatic update Grafana datasource docs from ${GITHUB_REPOSITORY}@${VM_GIT_COMMIT_SHA}"
git push origin ${VM_GIT_BRANCH_NAME}
gh pr create -f
working-directory: "__vm-docs-repo"
env:
GITHUB_TOKEN: ${{ secrets.VM_BOT_GH_TOKEN }}