dotfiles

My PC Dotfiles & Website

.github/workflows/website.yml (1563B)


 1name: "ci: Build and Deploy Site"
 2on:
 3  workflow_dispatch:
 4  push:
 5    branches:
 6      - stable
 7    paths:
 8      - "site/**"
 9      - "flake.lock"
10  pull_request:
11    paths:
12      - "site/**"
13      - "flake.lock"
14jobs:
15  deploy:
16    runs-on: ubuntu-latest
17    permissions:
18      contents: read
19      deployments: write
20    steps:
21      - name: Clone Repo
22        uses: actions/checkout@v7
23        with:
24          token: ${{ secrets.GITHUB_TOKEN }}
25          fetch-depth: 0
26      - name: Install Nix
27        uses: cachix/install-nix-action@v31
28        with:
29          extra_nix_config: |
30            experimental-features = nix-command flakes
31            accept-flake-config = true
32            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
33      - name: Build Zola Site
34        run: nix build .#website
35      - name: Prepare for Deployment
36        run: |
37          mkdir -p site/public
38          cp -rL result/* site/public/
39      - name: Deploy to Cloudflare
40        if: github.event_name != 'pull_request'
41        id: deploy
42        uses: cloudflare/wrangler-action@v4
43        with:
44          workingDirectory: "site"
45          command: deploy ${{ github.ref == 'refs/heads/stable' && '--env production' || '' }}
46          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
47          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
48          gitHubToken: ${{ secrets.GITHUB_TOKEN }}
49      - name: Print Deployment URL
50        if: github.event_name != 'pull_request'
51        run: |
52          echo "Site deployed to: ${{ steps.deploy.outputs.deployment-url }}"