Skip to content

Commit

Permalink
Merge pull request #39 from VictoriaMetrics/add-sync-logs
Browse files Browse the repository at this point in the history
add github aciton for log sync
  • Loading branch information
tenmozes authored Jul 3, 2024
2 parents 579ae30 + ea5d0a7 commit 5906c24
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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: |
echo '---
weight: 9
title: VictoriaLogs datasource for Grafana
menu:
docs:
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-datasource.md
cp docs/assets/* ../__vm-docs-repo/docs/
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 }}

0 comments on commit 5906c24

Please sign in to comment.