nuclei/.github/workflows/publish-docs.yaml

52 lines
1.6 KiB
YAML
Raw Normal View History

2021-08-25 07:44:28 +00:00
name: ⏰ Publish Docs
2021-08-20 09:54:33 +00:00
on:
2021-09-01 07:29:00 +00:00
push:
2021-09-06 09:34:09 +00:00
branches:
- dev
2021-08-20 09:54:33 +00:00
workflow_dispatch:
jobs:
2021-08-20 10:29:32 +00:00
docs:
2021-08-20 09:54:33 +00:00
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0
2021-08-20 10:29:32 +00:00
token: ${{ secrets.GITHUB_TOKEN }}
2021-08-20 09:54:33 +00:00
- name: "Set up Go"
uses: actions/setup-go@v2
with:
2021-09-01 10:10:53 +00:00
go-version: 1.17
2021-08-20 09:54:33 +00:00
- name: Generate YAML Syntax Documentation
2021-08-20 10:34:05 +00:00
id: generate-docs
2021-08-20 09:54:33 +00:00
run: |
if ! which dstdocgen > /dev/null; then
2021-08-20 10:29:32 +00:00
echo -e "Command dstdocgen not found! Installing\c"
2021-09-10 14:18:21 +00:00
go install github.com/projectdiscovery/yamldoc-go/cmd/docgen/dstdocgen@main
2021-08-20 09:54:33 +00:00
fi
go generate pkg/templates/templates.go
go build -o "cmd/docgen/docgen" cmd/docgen/docgen.go
2021-09-01 10:10:53 +00:00
./cmd/docgen/docgen ../SYNTAX-REFERENCE.md ../nuclei-jsonschema.json
2021-08-20 10:34:05 +00:00
echo "::set-output name=changes::$(git status -s | wc -l)"
2021-08-20 09:54:33 +00:00
working-directory: v2
- name: Commit files
2021-08-20 10:34:05 +00:00
if: steps.generate-docs.outputs.changes > 0
2021-08-20 09:54:33 +00:00
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
2021-09-01 10:10:53 +00:00
git add SYNTAX-REFERENCE.md nuclei-jsonschema.json
2021-08-25 07:44:28 +00:00
git commit -m "Auto Generate Syntax Docs + JSONSchema [$(date)] :robot:" -a
2021-08-20 09:54:33 +00:00
2021-08-20 10:34:05 +00:00
- name: Push changes
if: steps.generate-docs.outputs.changes > 0
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2021-09-10 14:18:21 +00:00
branch: ${{ github.ref }}