2023-07-13 21:52:52 +00:00
|
|
|
name: publish-docs
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
2023-07-14 07:47:10 +00:00
|
|
|
paths:
|
|
|
|
- 'docs/**'
|
2023-07-13 21:52:52 +00:00
|
|
|
workflow_dispatch: {}
|
|
|
|
permissions:
|
|
|
|
contents: read # This is required for actions/checkout and to commit back image update
|
|
|
|
deployments: write
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Code checkout
|
2023-09-07 11:07:56 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-07-13 21:52:52 +00:00
|
|
|
with:
|
|
|
|
path: main
|
|
|
|
- name: Checkout private code
|
2023-09-07 11:07:56 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-07-13 21:52:52 +00:00
|
|
|
with:
|
|
|
|
repository: VictoriaMetrics/vmdocs
|
|
|
|
token: ${{ secrets.VM_BOT_GH_TOKEN }}
|
|
|
|
path: docs
|
|
|
|
- name: Import GPG key
|
2024-07-03 12:45:33 +00:00
|
|
|
uses: crazy-max/ghaction-import-gpg@v6
|
2023-07-13 21:52:52 +00:00
|
|
|
with:
|
|
|
|
gpg_private_key: ${{ secrets.VM_BOT_GPG_PRIVATE_KEY }}
|
|
|
|
passphrase: ${{ secrets.VM_BOT_PASSPHRASE }}
|
|
|
|
git_user_signingkey: true
|
|
|
|
git_commit_gpgsign: true
|
2023-07-13 22:00:04 +00:00
|
|
|
workdir: docs
|
2023-07-14 09:35:55 +00:00
|
|
|
- name: Set short git commit SHA
|
|
|
|
id: vars
|
|
|
|
run: |
|
|
|
|
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
2023-07-14 10:19:37 +00:00
|
|
|
echo "short_sha=$calculatedSha" >> $GITHUB_OUTPUT
|
2023-07-14 09:35:55 +00:00
|
|
|
working-directory: main
|
2023-07-13 21:52:52 +00:00
|
|
|
- name: update code and commit
|
|
|
|
run: |
|
|
|
|
rm -rf content
|
2023-07-13 22:14:08 +00:00
|
|
|
cp -r ../main/docs content
|
2023-07-13 21:52:52 +00:00
|
|
|
make clean-after-copy
|
|
|
|
git config --global user.name "${{ steps.import-gpg.outputs.email }}"
|
|
|
|
git config --global user.email "${{ steps.import-gpg.outputs.email }}"
|
|
|
|
git add .
|
2023-07-14 09:35:55 +00:00
|
|
|
git commit -S -m "sync docs with VictoriaMetrics/VictoriaMetrics commit: ${{ steps.vars.outputs.short_sha }}"
|
2023-07-13 21:52:52 +00:00
|
|
|
git push
|
|
|
|
working-directory: docs
|