From 5eaa3b2c7bc65962ba138955ff898827d0166aea Mon Sep 17 00:00:00 2001 From: Wei18 <41205mw@gmail.com> Date: Sat, 23 Mar 2024 00:31:14 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20error:=20Unknown=20subcommand=20or=20plug?= =?UTF-8?q?in=20name=20=E2=80=98generate-documentation=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Doc.yml | 7 ++++++- Makefile | 4 ++-- Scripts/PackageBuilder.swift | 11 +++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Doc.yml b/.github/workflows/Doc.yml index 1016291c85..07dd3f6108 100644 --- a/.github/workflows/Doc.yml +++ b/.github/workflows/Doc.yml @@ -5,12 +5,17 @@ on: types: - published - edited + push: + branches: + - 'main' + paths: + - '.github/workflows/Doc.yml' permissions: contents: write concurrency: - group: ${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/Makefile b/Makefile index a2b17d2e83..8f7ce885fe 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ PACKAGE_PATHS := Package.swift commit: git add "$(file)" git commit -m "Commit via running $make $(file)" >/dev/null \ - && echo "::notice:: make $(file)\n" \ + && echo "::notice:: git commit $(file)\n" \ || true; touch "$(file)"; @@ -36,6 +36,7 @@ Sources/%: Sources/%/Client.swift @$(MAKE) commit file="$@" # Update openapi specification if needed +.PHONY: Submodule Submodule: ifdef GITHUB_ACTIONS ## https://docs.github.com/en/actions/learn-github-actions/variables @touch "$(OPENAPI_PATH)" @@ -56,5 +57,4 @@ $(PACKAGE_PATHS): $(SOURCE_DIRS) @$(MAKE) commit file="$@" # Install -.PHONY: Submodule install: Submodule .spi.yml diff --git a/Scripts/PackageBuilder.swift b/Scripts/PackageBuilder.swift index 60c9d2d631..548d842fcf 100644 --- a/Scripts/PackageBuilder.swift +++ b/Scripts/PackageBuilder.swift @@ -130,6 +130,7 @@ struct PackageBuilder { // swift-tools-version: \#(version.rawValue) // The swift-tools-version declares the minimum version of Swift required to build this package. + import Foundation import PackageDescription /// Generated via `$swift PackageBuilder.swift` @@ -157,8 +158,14 @@ struct PackageBuilder { ) ] ) - - + + // swift-docc is not needed for package users + if ProcessInfo.processInfo.environment["ENABLE_DOCC_SUPPORT"] == "1" { + package.dependencies += [ + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"), + ] + } + """# } func write() throws {