diff --git a/.github/workflows/cli-docs.yaml b/.github/workflows/cli-docs.yaml new file mode 100644 index 000000000..6797ffb43 --- /dev/null +++ b/.github/workflows/cli-docs.yaml @@ -0,0 +1,60 @@ +name: cli-docs + +on: + repository_dispatch: + types: [ update-cli-docs ] + +env: + GITHUB_TOKEN: ${{ github.token }} + +jobs: + update-cli-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout vcluster repository + uses: actions/checkout@v4 + with: + repository: loft-sh/vcluster + fetch-depth: 0 + ref: ${{ github.event.client_payload.ref }} + path: vcluster-repo + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" + - name: Setup Just + uses: extractions/setup-just@v2 + - name: Generate cli docs + working-directory: vcluster-repo + run: just generate-cli-docs + - uses: actions/checkout@v4 + with: + repository: loft-sh/vcluster-docs + fetch-depth: 0 + path: vcluster-docs + - name: Copy generated files + env: + PR_TITLE: ${{ github.event.client_payload.title }} + PR_REF: ${{ github.event.client_payload.ref }} + PR_VERSION: ${{ github.event.client_payload.version }} + run: | + # set git info + git config --global user.name "Loft Bot" + git config --global user.email 'loft-bot@users.noreply.github.com' + + cp -r ./vcluster-repo/docs/pages/cli vcluster-docs/vcluster + + cd vcluster-docs + git checkout -b "CLI-DOC-$PR_REF" + git add ./vcluster/cli + + # if there are no changes, exit early + if git diff-index --quiet HEAD --; then + exit 0 + fi + + git commit -m "DOC Update from $PR_TITLE" + + git push origin "CLI-DOC-$PR_REF" + gh pr create --base main -t "DOC Update from $PR_TITLE" --body "Autogenerated PR for CLI docs" + diff --git a/vcluster/cli/_category_.json b/vcluster/cli/_category_.json new file mode 100644 index 000000000..4ccc3d039 --- /dev/null +++ b/vcluster/cli/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "CLI", + "position": "4" +} +