added yandex file for verification #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Cloudflare Pages Deployment | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - next | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| name: Build and Deploy | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Cache Bun dependencies | |
| uses: actions/cache@v6 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: Cache Astro images | |
| uses: actions/cache@v6 | |
| with: | |
| path: | | |
| node_modules/.astro | |
| .astro | |
| key: astro-images-${{ hashFiles('src/**/*.{jpg,jpeg,png,webp,avif,gif,svg}') }} | |
| restore-keys: | | |
| astro-images- | |
| - name: Cache OG Images | |
| uses: actions/cache@v6 | |
| with: | |
| path: public/**/og.* | |
| key: og-images-${{ hashFiles('src/scripts/generate-og-images.ts', 'src/articles/**/index.mdx') }} | |
| restore-keys: | | |
| og-images- | |
| - name: Install Dependencies | |
| run: bun install | |
| - 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: ${{ github.ref_name == 'main' }} | |
| run: | | |
| echo "⏱️ Build started at $(date +%H:%M:%S)" | |
| bun run build | |
| echo "✔️ Build finished at $(date +%H:%M:%S)" | |
| echo "📦 Build size: $(du -sh dist/ | cut -f1)" | |
| - name: Validate Build Output | |
| run: | | |
| if [ ! -d "./dist" ]; then | |
| echo "❌ ERROR: Build output directory './dist' does not exist" | |
| exit 1 | |
| fi | |
| if [ ! -f "./dist/index.html" ]; then | |
| echo "❌ ERROR: Main index.html file was not generated" | |
| exit 1 | |
| fi | |
| echo "✔️ Build validation passed" | |
| - name: Create robots.txt for non-production builds | |
| if: github.ref_name != 'main' | |
| run: | | |
| echo "User-agent: *" > ./dist/robots.txt | |
| echo "Disallow: /" >> ./dist/robots.txt | |
| echo "🤖 robots.txt created for non-production branch" | |
| - name: Deploy Website to Cloudflare | |
| uses: cloudflare/wrangler-action@v4 | |
| with: | |
| accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
| apiToken: ${{ secrets.CF_DEPLOY_TOKEN }} | |
| command: pages deploy ./dist --project-name=stupid --branch=${{ github.ref_name }} --commit-dirty=true |