Skip to content

Commit

Permalink
updated the sync docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dipankardas011 authored Dec 2, 2024
1 parent 264c826 commit 4ad8be7
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions .github/workflows/sync-docs.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
name: Generate and Sync CLI Docs

on:
# push:
# branches:
# - main
# paths:
# - 'cli/**' # Adjust this to match your CLI code structure
# - 'gen/docs.md/**' # If the generator is in a separate directory
push:
branches:
- main
paths:
- 'cli/**' # Adjust this to match your CLI code structure
- 'gen/docs.md/**' # If the generator is in a separate directory
- '.github/workflows/sync-docs.yml'

workflow_dispatch:
inputs:
branch:
description: 'docs section to update'
type: choice
options:
- stable
- develop

concurrency:
group: sync-docs
Expand All @@ -31,7 +25,7 @@ jobs:

- name: checkout docs repo
run: |
git clone https://github.com/ksctl/docs.git docs-repo
git clone --branch dev https://github.com/ksctl/docs.git docs-repo
- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -46,18 +40,16 @@ jobs:
- name: Sync Generated Docs
run: |
# Copy generated docs
cp -rv cli-repo/gen/docs.md/. docs-repo/content/en/docs/${{ github.event.inputs.branch }}/Reference/.
ls -l docs-repo/content/en/docs/${{ github.event.inputs.branch }}/Reference/
cp -rv cli-repo/gen/docs.md/. docs-repo/content/en/docs/Reference/.
ls -l docs-repo/content/en/docs/Reference/
- name: Commit and Push Changes
working-directory: docs-repo
# env:
# GITHUB_TOKEN: ${{ secrets.PAT_SYNC_CLI_DOCS_TO_DOCS_REPO }}
run: |
git config user.name "Dipankar Das"
git config user.email "65275144+dipankardas011@users.noreply.github.com"
git config user.name "github-actions[bot]"
git config user.email "github-actions@github.com"
git remote add docs https://${{ secrets.PAT_SYNC_CLI_DOCS_TO_DOCS_REPO }}@github.com/ksctl/docs.git
git add content/en/docs/${{ github.event.inputs.branch }}/Reference
git add content/en/docs/Reference
git remote -v
git branch -v
git diff --quiet && git diff --staged --quiet || (git commit -m "chore(cicd): Update CLI documentation" && git push docs main)
git diff --quiet && git diff --staged --quiet || (git commit -m "chore(cicd): Update CLI documentation" && git push docs dev)

0 comments on commit 4ad8be7

Please sign in to comment.