Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/custom-domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,32 @@ jobs:
- name: Ensure CNAME file exists
run: |
echo "lemonademap.com" > CNAME

# Create or update index.html if it doesn't exist
if [ ! -f "index.html" ]; then
cat << 'EOF' > index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Redirecting to Lemonade Map</title>
<meta http-equiv="refresh" content="0;url=/Lemonade-map/">
<script>window.location.href = "/Lemonade-map/";</script>
</head>
<body>
<p>
If you are not redirected automatically, follow this
<a href="/Lemonade-map/">link to the Lemonade Map application</a>.
</p>
</body>
</html>
EOF
fi

git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
git add CNAME
git commit -m "Update CNAME file for custom domain" || echo "No changes to commit"
git add CNAME index.html
git commit -m "Update GitHub Pages configuration files" || echo "No changes to commit"
git push

- name: Update GitHub Pages settings
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,42 @@ jobs:

- name: Ensure CNAME file exists in gh-pages branch
run: |
# Create CNAME file in the dist directory before deployment
echo "lemonademap.com" > lemonade-map/dist/CNAME

# Clone the gh-pages branch
git clone --single-branch --branch gh-pages https://github.com/${{ github.repository }} gh-pages-temp
cd gh-pages-temp

# Create or update CNAME file
echo "lemonademap.com" > CNAME

# Create or update index.html if it doesn't exist
if [ ! -f "index.html" ]; then
cat << 'EOF' > index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Redirecting to Lemonade Map</title>
<meta http-equiv="refresh" content="0;url=/Lemonade-map/">
<script>window.location.href = "/Lemonade-map/";</script>
</head>
<body>
<p>
If you are not redirected automatically, follow this
<a href="/Lemonade-map/">link to the Lemonade Map application</a>.
</p>
</body>
</html>
EOF
fi

# Commit and push changes
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
git add CNAME
git commit -m "Update CNAME file for custom domain" || echo "No changes to commit"
git add CNAME index.html
git commit -m "Update GitHub Pages configuration files" || echo "No changes to commit"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} gh-pages

- name: Verify GitHub Pages Configuration
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/gh-pages-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ on:
branches:
- gh-pages

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

jobs:
configure-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Setup Pages
uses: actions/configure-pages@v4
with:
enablement: true

# Verify index.html exists at the root
- name: Verify index.html
Expand All @@ -27,6 +37,7 @@ jobs:
<head>
<meta charset="utf-8">
<title>Redirecting to Lemonade Map</title>
<meta http-equiv="refresh" content="0;url=/Lemonade-map/">
<script>window.location.href = "/Lemonade-map/";</script>
</head>
<body>
Expand All @@ -43,4 +54,13 @@ EOF
- name: Verify CNAME file
run: |
echo "lemonademap.com" > CNAME
echo "Created CNAME file with domain: lemonademap.com"
echo "Created CNAME file with domain: lemonademap.com"

# Commit changes if any were made
- name: Commit changes
run: |
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
git add index.html CNAME
git commit -m "Update GitHub Pages configuration files" || echo "No changes to commit"
git push
22 changes: 21 additions & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,32 @@ jobs:
npm run build

# Copy the root index.html redirect file to the dist directory
- name: Ensure correct index.html
- name: Ensure correct files
run: |
# Make sure the dist directory exists
mkdir -p lemonade-map/dist
# Copy 404.html to the root of the dist directory
cp lemonade-map/public/404.html lemonade-map/dist/
# Create CNAME file in the dist directory
echo "lemonademap.com" > lemonade-map/dist/CNAME
# Create root index.html for redirection
cat << 'EOF' > lemonade-map/dist/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Redirecting to Lemonade Map</title>
<meta http-equiv="refresh" content="0;url=/Lemonade-map/">
<script>window.location.href = "/Lemonade-map/";</script>
</head>
<body>
<p>
If you are not redirected automatically, follow this
<a href="/Lemonade-map/">link to the Lemonade Map application</a>.
</p>
</body>
</html>
EOF

- name: Setup Pages
uses: actions/configure-pages@v4
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<title>Redirecting to Lemonade Map</title>
<meta http-equiv="refresh" content="0;url=/Lemonade-map/">
<script>
window.location.href = "/Lemonade-map/";
</script>
Expand Down
2 changes: 1 addition & 1 deletion lemonade-map/dist/CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lemonade-map.example.com
lemonademap.com