diff --git a/.github/workflows/custom-domain.yml b/.github/workflows/custom-domain.yml index 0f74dad..5eb5692 100644 --- a/.github/workflows/custom-domain.yml +++ b/.github/workflows/custom-domain.yml @@ -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 + + +
+ ++ If you are not redirected automatically, follow this + link to the Lemonade Map application. +
+ + +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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e906a32..999c5c4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -103,6 +103,9 @@ 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 @@ -110,11 +113,32 @@ jobs: # 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 + + + + ++ If you are not redirected automatically, follow this + link to the Lemonade Map application. +
+ + +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 diff --git a/.github/workflows/gh-pages-config.yml b/.github/workflows/gh-pages-config.yml index 1d351fc..1bf8129 100644 --- a/.github/workflows/gh-pages-config.yml +++ b/.github/workflows/gh-pages-config.yml @@ -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 @@ -27,6 +37,7 @@ jobs:+ If you are not redirected automatically, follow this + link to the Lemonade Map application. +
+ + +EOF - name: Setup Pages uses: actions/configure-pages@v4 diff --git a/index.html b/index.html index e13de0a..6beb42f 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@