Skip to content

Commit 98b1386

Browse files
committed
Fix latest redirects
1 parent 1326696 commit 98b1386

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/swift-generate-and-publish-docs.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,32 @@ jobs:
278278
</body>
279279
</html>
280280
EOF
281-
- name: Create latest symlink
281+
- name: Create latest index
282282
if: ${{ needs.basic-context.outputs.is-latest == 'true' }}
283283
working-directory: repository
284284
env:
285-
VERSION_NAME: ${{ needs.basic-context.outputs.version-name }}
285+
REDIRECT_URL: ${{ needs.basic-context.outputs.base-url }}/${{ needs.basic-context.outputs.version-base-path }}/documentation
286+
REPO_NAME: ${{ inputs.repository }}
286287
run: |
287-
rm -f 'latest'
288-
ln -s "${VERSION_NAME}" 'latest'
288+
if [ -d 'latest' ]; then
289+
rm -rf 'latest'
290+
else
291+
rm -f 'latest'
292+
fi
293+
mkdir -p 'latest'
294+
cat > 'latest/index.html' <<EOF
295+
<!DOCTYPE html>
296+
<html lang="en">
297+
<head>
298+
<title>${REPO_NAME} Documentation</title>
299+
<meta charset="utf-8"/>
300+
<meta http-equiv="refresh" content="0; url=${REDIRECT_URL}"/>
301+
</head>
302+
<body>
303+
<p>Redirecting...</p>
304+
</body>
305+
</html>
306+
EOF
289307
- name: Push changes
290308
working-directory: repository
291309
env:

0 commit comments

Comments
 (0)