Skip to content

Update StatsLighthouse.astro #216

Update StatsLighthouse.astro

Update StatsLighthouse.astro #216

Workflow file for this run

name: Cloudflare Pages Deployment
on:
push:
branches:
- main
- next
schedule:
- cron: "20 4 * * *"
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.3.3
- name: Install Dependencies
run: deno task install
- name: Get branch name
run: echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Set environment variables
run: |
if [ "${{ env.BRANCH_NAME }}" = "main" ]; then
echo "PRODUCTION_BUILD=true" >> $GITHUB_ENV
fi
- name: Build Website
env:
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
CF_RADAR_TOKEN: ${{ secrets.CF_RADAR_TOKEN }}
GOOGLE_PAGESPEED_KEY: ${{ secrets.GOOGLE_PAGESPEED_KEY }}
PRODUCTION_BUILD: ${{ env.PRODUCTION_BUILD }}
run: deno task build
- name: Create robots.txt for non-production builds
if: env.BRANCH_NAME != 'main'
run: |
echo "User-agent: *" > ./dist/robots.txt
echo "Disallow: /" >> ./dist/robots.txt
echo "robots.txt created successfully for non-production branch."
- name: Install Wrangler
run: deno install --global --allow-scripts npm:wrangler@latest
- name: Deploy Website to Cloudflare
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CF_ACCOUNT_ID }}
apiToken: ${{ secrets.CF_DEPLOY_TOKEN }}
command: pages deploy ./dist --project-name=stupid --branch=${{ env.BRANCH_NAME }} --commit-dirty=true