-
Notifications
You must be signed in to change notification settings - Fork 349
103 lines (93 loc) · 3.08 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: "Update docs"
on:
push:
branches:
- master
paths:
- 'README.md'
- 'charts/**/README.md'
- 'charts/**/README.md.gotmpl'
- '**/README.md'
- '**/README.md.gotmpl'
- '.github/workflows/docs.yaml'
jobs:
publish-readme:
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout charts repo
uses: actions/checkout@v4
with:
path: __vm-helm-charts
- name: Checkout docs repo
uses: actions/checkout@v4
with:
repository: VictoriaMetrics/vmdocs
ref: main
token: ${{ secrets.VM_BOT_GH_TOKEN }}
path: __vm-docs
- name: Import GPG key for VM repo
id: import-gpg
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
git_config_global: true
- name: Generate docs
run:
make gen-docs
working-directory: __vm-helm-charts
- name: Copy docs
id: update
run: |
rsync -zarv \
--include="*/" \
--include="*.webp" \
--include="*.md" \
--exclude="*" \
charts/ ../__vm-docs/content/helm/
cp *.md ../__vm-docs/content/helm/
echo "SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT
cp -f README.md ${{ runner.temp }}/README.md
for readme in $(find charts/*/README.md)
do
mkdir -p $(dirname ${{ runner.temp }}/$readme)
cp -f $readme ${{ runner.temp }}/$readme
done
working-directory: __vm-helm-charts
- name: Push to vmdocs
run: |
git config --global user.name "${{ steps.import-gpg.outputs.email }}"
git config --global user.email "${{ steps.import-gpg.outputs.email }}"
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
git add content/helm
git commit -S -m "sync docs with VictoriaMetrics/helm-docs commit: ${{ steps.update.outputs.SHORT_SHA }}"
git push
fi
working-directory: __vm-docs
env:
GH_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}"
- name: Checkout to pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: __vm-helm-charts
- name: Synchronize docs
run: |
cp -f ${{ runner.temp }}/README.md .
cp -fr ${{ runner.temp }}/charts ./
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
git add README.md
git add charts/*/README.md
git commit -S -m "Synchronize docs"
git push origin gh-pages
fi
working-directory: __vm-helm-charts
env:
GH_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}"