67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: Document Generation
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
Run-All:
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
# check out the repo
|
|
- name: Repo Code Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
|
|
# Get values for cache paths to be used in later steps
|
|
- id: go-cache-paths
|
|
working-directory: ./src
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Golang Setup
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
cache: true
|
|
cache-dependency-path: src/go.sum
|
|
|
|
# download packages
|
|
- name: Cache Go Mod
|
|
uses: actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Run go mod download
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
working-directory: ./src
|
|
run: go mod download
|
|
|
|
# run the markdown generator
|
|
- name: Generate Markdown
|
|
working-directory: ./src
|
|
run: |
|
|
go run ./cmd/mdgen/mdgen.go generate
|
|
|
|
# migrate generated md files into /docs/docs/cli
|
|
- name: Move CLI .md to Docs
|
|
run: |
|
|
mkdir -p ./docs/docs/cli
|
|
mv ./src/cmd/mdgen/cli_markdown/* ./docs/docs/cli/
|
|
rm -R ./src/cmd/mdgen/cli_markdown/
|
|
|
|
# make a commit for any file changes
|
|
- name: Commit the Auto-Generated Files
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: Documentation Auto-generation
|
|
commit_user_name: github-actions[bot]
|
|
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
|
|
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
|
|