48 lines
1.7 KiB
YAML
48 lines
1.7 KiB
YAML
---
|
|
name: docs-autoupdate
|
|
|
|
# checkov:skip=CKV2_GHA_1:Write permission is needed to push changes to the repository
|
|
permissions: write-all
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
|
|
jobs:
|
|
update-docs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Update docs
|
|
run: |
|
|
if ! [[ -e USAGE.md ]]; then touch USAGE.md; fi
|
|
mv USAGE.md USAGE.md.old
|
|
mkdir tools
|
|
cp ./builder ./tools/
|
|
chmod +x ./tools/builder
|
|
{
|
|
echo '# KF2-BuildTools'
|
|
echo '[![title](https://img.shields.io/badge/Help-Page-w)](https://github.com/GenZmeY/KF2-BuildTools)'
|
|
echo '[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)'
|
|
echo '[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)'
|
|
echo '```text'
|
|
./tools/builder -nch
|
|
echo '```'
|
|
} >> USAGE.md
|
|
if ! cmp -s USAGE.md USAGE.md.old; then
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions"
|
|
git add USAGE.md
|
|
git commit -m "Update USAGE.md to version $(git describe 2> /dev/null)"
|
|
else
|
|
echo "No change, skip updating USAGE.md"
|
|
fi
|
|
- name: Push changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: ${{ github.ref }}
|