dotfiles

My PC Dotfiles & Website

website.yml (1425B)


name: "ci: Build and Deploy Site"
on:
  workflow_dispatch:
  push:
    branches:
      - stable
    paths:
      - "site/**"
  pull_request:
    paths:
      - "site/**"
jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      deployments: write
    steps:
      - name: Clone Repo
        uses: actions/checkout@v7
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          fetch-depth: 0
      - name: Install Nix
        uses: cachix/install-nix-action@v31
        with:
          extra_nix_config: |
            experimental-features = nix-command flakes
            accept-flake-config = true
            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
      - name: Build Zola Site
        run: nix build .#website
      - name: Prepare for Deployment
        run: |
          mkdir -p site/public
          cp -rL result/* site/public/
      - name: Deploy to Cloudflare
        id: deploy
        uses: cloudflare/wrangler-action@v4
        with:
          workingDirectory: "site"
          command: deploy ${{ github.ref == 'refs/heads/stable' && '--env production' || '' }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          gitHubToken: ${{ secrets.GITHUB_TOKEN }}
      - name: Print Deployment URL
        run: |
          echo "Site deployed to: ${{ steps.deploy.outputs.deployment-url }}"