Skip to content

Commit 97f3b5c

Browse files
committed
readd steps
1 parent 3514659 commit 97f3b5c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/ephemeral.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,37 @@ jobs:
5656
echo "NEW_URL=$NEW_URL" >> $GITHUB_ENV
5757
env:
5858
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
59+
60+
- name: Generate index.html with New Redirect URL
61+
run: |
62+
NEW_URL="${{ env.NEW_URL }}"
63+
64+
# Validate the URL
65+
if [[ ! "$NEW_URL" =~ ^https?:// ]]; then
66+
echo "Error: Invalid URL provided."
67+
exit 1
68+
fi
69+
70+
echo "Redirecting to: $NEW_URL"
71+
72+
cat > index.html <<EOL
73+
<!DOCTYPE html>
74+
<html lang="en">
75+
<head>
76+
<meta charset="UTF-8">
77+
<meta http-equiv="refresh" content="0; URL=${NEW_URL}">
78+
<title>Redirecting...</title>
79+
</head>
80+
<body>
81+
<p>If you are not redirected automatically, follow this <a href="${NEW_URL}">link</a>.</p>
82+
</body>
83+
</html>
84+
EOL
85+
- name: Switch to gh-pages Branch and Commit Changes
86+
run: |
87+
git fetch origin gh-pages || echo "gh-pages branch does not exist; creating it."
88+
git checkout gh-pages || git checkout --orphan gh-pages
89+
git rm -rf . # Remove all files in the branch
90+
git add index.html
91+
git commit -m "Update redirect to ${NEW_URL}"
92+
git push origin gh-pages --force

0 commit comments

Comments
 (0)