File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
.github/workflows/scripts Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -31,15 +31,23 @@ if [ -z "$package_files" ]; then
3131 fatal " Package.swift not found. Please ensure you are running this script from the root of a Swift package."
3232fi
3333
34- for package_file in $package_files ; do
35- log " Editing $package_file ..."
36- cat << EOF >> "$package_file "
34+ # yq 3.1.0-3 doesn't have filter, otherwise we could replace the grep call with "filter(.identity == "swift-docc-plugin") | keys | .[]"
35+ hasDoccPlugin=$( swift package dump-package | yq -r ' .dependencies[].sourceControl' | grep -e " \" identity\" : \" swift-docc-plugin\" " || true)
36+ if [[ -n $hasDoccPlugin ]]
37+ then
38+ log " swift-docc-plugin already exists"
39+ else
40+ log " Appending swift-docc-plugin"
41+ for package_file in $package_files ; do
42+ log " Editing $package_file ..."
43+ cat << EOF >> "$package_file "
3744
3845package.dependencies.append(
3946 .package(url: "https://github.com/swiftlang/swift-docc-plugin", "1.0.0"..<"1.4.0")
4047)
4148EOF
42- done
49+ done
50+ fi
4351
4452log " Checking documentation targets..."
4553for target in $( yq -r ' .builder.configs[].documentation_targets[]' .spi.yml) ; do
You can’t perform that action at this time.
0 commit comments