-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a workflow for publishing the docs
Signed-off-by: ytimocin <ytimocin@microsoft.com>
- Loading branch information
Showing
2 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Generate and Publish CLI Docs on Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
generate-and-publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
cache: false | ||
|
||
- name: Install dependencies | ||
run: go mod tidy | ||
|
||
- name: Generate CLI Docs | ||
run: | | ||
mkdir -p release/docs | ||
make generate-cli-docs OUTPUT_PATH=release/docs/ | ||
- name: Checkout Docs Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: prompt-ops/docs | ||
path: prompt-ops/docs | ||
|
||
- name: Copy Generated Docs | ||
run: | | ||
mkdir -p docs/content/en/cli | ||
cp -R release/docs/* docs/content/en/cli/ | ||
- name: Commit and Push Changes | ||
run: | | ||
cd docs | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add content/en/cli | ||
git diff --cached --exit-code || git commit -m "chore: Update CLI documentation for release ${{ github.event.release.tag_name }}" | ||
git push origin HEAD:automated-docs-update-${{ github.event.release.tag_name }} | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.POPS_GITHUB_OPS_PAT }} | ||
commit-message: Update CLI documentation for release ${{ github.event.release.tag_name }} | ||
title: "📄 Update CLI Documentation for Release ${{ github.event.release.tag_name }}" | ||
body: | | ||
This PR updates the CLI documentation to reflect the changes in release `${{ github.event.release.tag_name }}`. | ||
### Changes | ||
- Updated CLI commands and usage examples. | ||
- Added new features introduced in this release. | ||
### How to Test | ||
- Verify the generated documentation in the [docs repository](https://github.com/prompt-ops/docs). | ||
base: main | ||
head: automated-docs-update-${{ github.event.release.tag_name }} | ||
branch-suffix: automated-docs-update | ||
delete-branch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
OUTPUT_PATH ?= docs | ||
|
||
.PHONY: generate-cli-docs | ||
generate-cli-docs: | ||
@echo "Generating CLI docs for Prompt-Ops..." | ||
@go run cmd/docgen/main.go docs | ||
@echo "Generation complete." | ||
@go run cmd/docgen/main.go $(OUTPUT_PATH) | ||
@echo "Generation complete. Docs generated at $(OUTPUT_PATH)" |