diff --git a/.github/scripts/update-css-link.sh b/.github/scripts/update-css-link.sh new file mode 100644 index 0000000..f12624b --- /dev/null +++ b/.github/scripts/update-css-link.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Find the CSS file in the assets directory +CSS_FILE=$(find ./build/client/assets -name "root*.css" -type f) + +if [ -z "$CSS_FILE" ]; then + echo "No CSS file found in ./build/client/assets" + exit 1 +fi + +# Get just the filename from the path +CSS_FILENAME=$(basename "$CSS_FILE") + +# Update the index.html file to include the CSS link +# First, check if a CSS link already exists +if grep -q "" ./build/client/index.html; then + # Update existing CSS link + sed -i "s|||" ./build/client/index.html +else + # Add new CSS link before closing head tag + sed -i "s||\n|" ./build/client/index.html +fi + +echo "Updated index.html with CSS link: $CSS_FILENAME" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cf82460..5b4641b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,27 +1,16 @@ -# Simple workflow for deploying static content to GitHub Pages name: Deploy static content to Pages - on: - # Runs on pushes targeting the default branch push: branches: ['trunk'] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: 'pages' cancel-in-progress: false - jobs: - # Single deploy job since we're just deploying deploy: environment: name: github-pages @@ -30,26 +19,24 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Bun uses: oven-sh/setup-bun@v1 with: bun-version: latest - - name: Install dependencies run: bun install - - name: Build run: bun run build - + - name: Update CSS link + run: | + chmod +x .github/scripts/update-css-link.sh + .github/scripts/update-css-link.sh - name: Setup Pages uses: actions/configure-pages@v5 - - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: './build/client' - - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4