diff --git a/.github/workflows/trigger-website-update.yaml b/.github/workflows/trigger-website-update.yaml index 9f0bab1..cc6dd87 100644 --- a/.github/workflows/trigger-website-update.yaml +++ b/.github/workflows/trigger-website-update.yaml @@ -5,14 +5,37 @@ on: - main paths: - 'docs/**' + pull_request: + paths: + - 'docs/**' jobs: - send-event: + # Dispatch event for production build on docs changes in main branch + production-build: runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' steps: - - name: Repository Dispatch + - name: Dispatch Production Build Event uses: peter-evans/repository-dispatch@v3 with: token: ${{ secrets.PAT }} repository: anynines/klutchio-website event-type: klutch-docs-updated-on-main + + # Dispatch event for PR preview on docs + preview-build: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Dispatch PR Preview Event + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.PAT }} + repository: anynines/klutchio-website + event-type: preview-docs-pr + client-payload: > + { + "pr_number": "${{ github.event.number }}", + "repo": "${{ github.repository }}", + "sha": "${{ github.event.pull_request.head.sha }}" + } diff --git a/README.md b/README.md index 5936533..13c5a04 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,22 @@ Advantages include: [go.work docs]: https://go.dev/doc/tutorial/workspaces +## Documentation Workflow + +We use GitHub Actions to automate our documentation process: + +- Pull requests modifying `docs/` trigger preview builds. +- Previews are deployed to PR-specific URLs for easy review. +- Merges to main automatically update the production documentation. +- Preview environments are cleaned up after PR merges. + +When contributing to documentation: + +1. Create a PR with your changes. +2. Check the automatically posted comment for the preview link. +3. Review your changes in the preview environment. +4. After approval and merge, changes will go live on the main site. + ## Credits - The Klutch Authors