diff --git a/.github/workflows/agents-publish.yml b/.github/workflows/agents-publish.yml index 421eaa4e3..c9987bcce 100644 --- a/.github/workflows/agents-publish.yml +++ b/.github/workflows/agents-publish.yml @@ -55,3 +55,7 @@ jobs: - run: pnpm publish --no-git-checks . env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Update Doc" + uses: peter-evans/repository-dispatch@v2 + with: + event-type: doc-build diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 41815cac5..806be4546 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -2,15 +2,17 @@ name: Build documentation on: workflow_dispatch: + repository_dispatch: + types: [doc-build] push: branches: - main paths: - "README.md" - - "docs/**" - - "packages/hub/package.json" - - "packages/inference/package.json" - - "packages/agents/package.json" + - "packages/hub/README.md" + - "packages/inference/README.md" + - "packages/agents/README.md" + - ".github/workflows/documentation.yml" jobs: build: diff --git a/.github/workflows/hub-publish.yml b/.github/workflows/hub-publish.yml index 4a88a2df2..e971166e2 100644 --- a/.github/workflows/hub-publish.yml +++ b/.github/workflows/hub-publish.yml @@ -55,3 +55,7 @@ jobs: - run: pnpm publish --no-git-checks . env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Update Doc" + uses: peter-evans/repository-dispatch@v2 + with: + event-type: doc-build diff --git a/.github/workflows/tasks-publish.yml b/.github/workflows/tasks-publish.yml index 30152dc3f..8192a62a1 100644 --- a/.github/workflows/tasks-publish.yml +++ b/.github/workflows/tasks-publish.yml @@ -52,3 +52,7 @@ jobs: - run: pnpm publish --no-git-checks . env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Update Doc" + uses: peter-evans/repository-dispatch@v2 + with: + event-type: doc-build diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73ad040d6..145762f94 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,9 +25,8 @@ If you want to run only specific tests, you can do `pnpm test -- -t "test name"` - Add the package name in [`pnpm-workspace.yaml`](pnpm-workspace.yaml) - Add a `package.json` inspired from the other packages ([`packages/hub/package.json`](packages/hub/package.json) / [`packages/agents/package.json`](packages/agents/package.json)) in `packages//package.json` - Run `pnpm install` at the root -- Edit [`packages/doc-internal/package.json`](packages/doc-internal/package.json) and add the two commands in the `scripts` section: - - `prepublish-` - - `doc-` +- Edit [`packages/doc-internal/package.json`](packages/doc-internal/package.json) and add the command in the `scripts` section: + - `doc-` (don't forget to edit the `start` command too) - Add the `-publish.yml` file in the `.github/workflows` folder, inspired from the other packages - Add the package in the main README.md - Add a `tsup.config.ts` file in the package folder, inspired from the other packages, or just use `tsup src/index.ts --format cjs,esm --clean --dts` as the build command diff --git a/packages/doc-internal/README.md b/packages/doc-internal/README.md index c631e5d1a..8d51e72ab 100644 --- a/packages/doc-internal/README.md +++ b/packages/doc-internal/README.md @@ -11,16 +11,6 @@ We run a few scripts in between, [fix-md-links](./fix-md-links.ts) and [update-t ```console # Generate all docs pnpm run start - -# Generate docs for @huggingface/hub -pnpm run prepublish-hub - -# Generate docs for @huggingface/inference -pnpm run prepublish-inference - -# Generate docs for @huggingface/agents -pnpm run prepublish-agents - ``` ## HTML docs diff --git a/packages/doc-internal/package.json b/packages/doc-internal/package.json index 8d6ef86ba..681c0f0bc 100644 --- a/packages/doc-internal/package.json +++ b/packages/doc-internal/package.json @@ -10,9 +10,6 @@ "lint:check": "eslint --ext .cjs,.ts .", "format": "prettier --write .", "format:check": "prettier --check .", - "prepublish-hub": "pnpm run fix-cdn-versions && pnpm run doc-hub && cp ../../README.md ../../docs/index.md && pnpm run update-toc && pnpm run fix-md-links && pnpm run fix-md-headinghashlinks", - "prepublish-inference": "pnpm run fix-cdn-versions && pnpm run doc-inference && cp ../../README.md ../../docs/index.md && pnpm run update-toc && pnpm run fix-md-links && pnpm run fix-md-headinghashlinks", - "prepublish-agents": "pnpm run fix-cdn-versions && pnpm run doc-agents && cp ../../README.md ../../docs/index.md && pnpm run update-toc && pnpm run fix-md-links && pnpm run fix-md-headinghashlinks", "doc-hub": "typedoc --tsconfig ../hub/tsconfig.json --githubPages false --plugin typedoc-plugin-markdown --out ../../docs/hub --hideBreadcrumbs --hideInPageTOC --sourceLinkTemplate https://github.com/huggingface/huggingface.js/blob/main/{path}#L{line} ../hub/index.ts", "doc-inference": "typedoc --tsconfig ../inference/tsconfig.json --githubPages false --plugin typedoc-plugin-markdown --out ../../docs/inference --hideBreadcrumbs --hideInPageTOC --sourceLinkTemplate https://github.com/huggingface/huggingface.js/blob/main/{path}#L{line} ../inference/src/index.ts", "doc-agents": "typedoc --tsconfig ../agents/tsconfig.json --githubPages false --plugin typedoc-plugin-markdown --out ../../docs/agents --hideBreadcrumbs --hideInPageTOC --sourceLinkTemplate https://github.com/huggingface/huggingface.js/blob/main/{path}#L{line} ../agents/src/index.ts",