Skip to content

Commit 052f081

Browse files
committed
fix: Use tr for lowercase conversion (bash 3.2 compatible)
- Changed from bash 4+ parameter expansion to tr command - Fixes bad substitution error in GitHub Actions macOS runner
1 parent 1896bcb commit 052f081

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

scripts/publish-docc-to-github-pages.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,17 @@ cd "$REPO_ROOT"
7878
# Resolve package dependencies first
7979
swift package resolve
8080

81+
# Convert package name to lowercase (bash 3.2 compatible)
82+
PACKAGE_NAME_LOWER=$(echo "$PACKAGE_NAME" | tr '[:upper:]' '[:lower:]')
83+
8184
# Generate documentation using swift package generate-documentation
8285
# This requires the swift-docc-plugin to be added to Package.swift
8386
if swift package --allow-writing-to-directory "$DOCBUILD_DIR" \
8487
generate-documentation \
8588
--target "$PACKAGE_NAME" \
8689
--output-path "$DOCBUILD_DIR" \
8790
--transform-for-static-hosting \
88-
--hosting-base-path "/${PACKAGE_NAME,,}" 2>&1; then
91+
--hosting-base-path "/${PACKAGE_NAME_LOWER}" 2>&1; then
8992
echo -e "${GREEN}DocC documentation generated successfully${NC}"
9093

9194
# The documentation is already transformed for static hosting in DOCBUILD_DIR
@@ -161,7 +164,7 @@ fi
161164

162165
# Determine the documentation directory
163166
# For Swift packages, we'll publish to a subdirectory like /designalgorithmskit/
164-
DOCS_DIR="${PACKAGE_NAME,,}" # Convert to lowercase
167+
DOCS_DIR="$PACKAGE_NAME_LOWER" # Use lowercase version
165168
mkdir -p "$DOCS_DIR"
166169

167170
echo "Using documentation directory: $DOCS_DIR"
@@ -190,10 +193,10 @@ if [ -n "$STATIC_DOCS_DIR" ] && [ -d "$STATIC_DOCS_DIR" ]; then
190193
<head>
191194
<meta charset="UTF-8">
192195
<meta name="viewport" content="width=device-width, initial-scale=1.0">
193-
<meta http-equiv="refresh" content="0; url=/${DOCS_DIR}/documentation/${PACKAGE_NAME,,}/">
196+
<meta http-equiv="refresh" content="0; url=/${DOCS_DIR}/documentation/${PACKAGE_NAME_LOWER}/">
194197
<title>${PACKAGE_NAME} Documentation</title>
195198
<script>
196-
window.location.href = "/${DOCS_DIR}/documentation/${PACKAGE_NAME,,}/";
199+
window.location.href = "/${DOCS_DIR}/documentation/${PACKAGE_NAME_LOWER}/";
197200
</script>
198201
</head>
199202
<body>

0 commit comments

Comments
 (0)