From 438431046302f361c5bf3fa944cd690aa8703795 Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 19:52:34 -0700 Subject: [PATCH 1/8] add CLAUDE init file --- CLAUDE.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..acf9c3f --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,83 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Overview + +This is a personal blog and portfolio website for Salar Rahmanian (softinio.com) built with Zola static site generator, managed with Nix Flakes, and deployed to Cloudflare Pages. + +## Commands + +### Development +```bash +# Enter development shell with all dependencies +nix develop + +# Start local development server +zola serve + +# Build the site +zola build +``` + +### Building with Nix +```bash +# Build the site using Nix +nix build + +# The output will be in result/ + +# Update flake inputs to latest versions +nix flake update +``` + +### Deployment +```bash +# Deploy to Cloudflare Pages +wrangler pages deploy public/ +``` + +### Testing +```bash +# Check for broken links and validate build +zola check +``` + +### CI/CD + +This project uses GitHub Actions for continuous integration and deployment: + +- **Main branch pushes**: Deploys directly to production (https://www.softinio.com) +- **Pull requests**: Deploys to preview URLs (https://[branch-name].softinio.com) +- **Other branch pushes**: No deployment (only builds on PR creation) + +Required secrets in GitHub repository settings: +- `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID +- `CLOUDFLARE_API_TOKEN`: Cloudflare API token with Pages:Edit permissions + +## Architecture + +### Technology Stack +- **Static Site Generator**: Zola (Rust-based) - NOT Hugo +- **Theme**: Tabi theme (pinned to specific commit in flake.nix) +- **Package Management**: Nix Flakes +- **Hosting**: Cloudflare Pages +- **Comments**: Isso (self-hosted at comments.softinio.com) +- **Analytics**: Matomo (self-hosted at wisdom.softinio.com) + +### Content Structure +- `content/post/`: Main blog articles with full metadata +- `content/projects/`: Project showcase pages +- `content/talks/`: Conference presentations +- `content/til/`: "Today I Learned" short posts +- `content/archived/`: Archived posts + +### Key Configuration Files +- `config.toml`: Zola site configuration with theme settings, CSP headers, and integrations +- `flake.nix`: Nix development environment and build configuration +- `wrangler.toml`: Cloudflare deployment configuration + +### Template Customizations +- `templates/partials/custom_header.html`: Matomo analytics integration +- `templates/shortcodes/`: YouTube and PeerTube video embedding +- `templates/subscribe.html`: Newsletter subscription page \ No newline at end of file From c827644d4fe9b695f0fa53ed1cebaed106fbabaf Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 19:52:50 -0700 Subject: [PATCH 2/8] flake update --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index cf55e4b..469c98d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1707956935, - "narHash": "sha256-ZL2TrjVsiFNKOYwYQozpbvQSwvtV/3Me7Zwhmdsfyu4=", + "lastModified": 1749285348, + "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a4d4fe8c5002202493e87ec8dbc91335ff55552c", + "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", "type": "github" }, "original": { From a4f3aeee9f3daa868e99bc0ee22269b9f949c05b Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 19:53:15 -0700 Subject: [PATCH 3/8] replace woodpecker ci with github actions --- .github/workflows/deploy.yml | 52 ++++++++++++++++++++++++++++++++++++ .woodpecker.yml | 35 ------------------------ README.md | 2 +- 3 files changed, 53 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 .woodpecker.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..2808628 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +name: Build and Deploy + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v31 + with: + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Build site (pull request) + if: github.event_name == 'pull_request' + run: | + # Update base URL for PR preview + sed -i "s|base_url = \"https://www.softinio.com\"|base_url = \"https://${{ github.head_ref }}.softinio.com\"|" ./config.toml + nix build + nix flake show + ls result + + - name: Deploy to Cloudflare Pages (pull request) + if: github.event_name == 'pull_request' + run: | + nix develop --command wrangler pages deploy result --branch=${{ github.head_ref }} --project-name=softinio --commit-dirty=true + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + + - name: Build site (main branch) + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: | + nix build + + - name: Deploy to Cloudflare Pages (main branch) + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: | + nix develop --command wrangler pages deploy result --project-name=softinio --commit-dirty=true + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} \ No newline at end of file diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index 3aa04b0..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,35 +0,0 @@ -steps: - - name: build - image: nixos/nix - commands: - - echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf - - nix profile install nixpkgs#gnused --impure - - sed -i "s|base_url = \"https://www.softinio.com\"|base_url = \"https://$CI_COMMIT_BRANCH.softinio.com\"|" ./config.toml - - nix build - - nix flake show - - ls result - - nix develop --command wrangler pages deploy result --branch=$CI_COMMIT_BRANCH --project-name=softinio --commit-dirty=true - environment: - CLOUDFLARE_ACCOUNT_ID: - from_secret: cloudflare_account_id - CLOUDFLARE_API_TOKEN: - from_secret: cloudflare_api_token - when: - event: [push] - branch: - exclude: [ main ] - - - name: deploy - image: nixos/nix - commands: - - echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf - - nix build - - nix develop --command wrangler pages deploy result --project-name=softinio --commit-dirty=true - environment: - CLOUDFLARE_ACCOUNT_ID: - from_secret: cloudflare_account_id - CLOUDFLARE_API_TOKEN: - from_secret: cloudflare_api_token - when: - event: push - branch: main diff --git a/README.md b/README.md index a2dd144..48a920a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![status-badge](https://ci.softinio.com/api/badges/1/status.svg)](https://ci.softinio.com/repos/1) +[![Build and Deploy](https://github.com/softinio/softinio.com/actions/workflows/deploy.yml/badge.svg)](https://github.com/softinio/softinio.com/actions/workflows/deploy.yml) # softinio.com Personal Blog of Salar Rahmanian, https://www.softinio.com From 1fd2958cdfe5aaf3d15e3654ad3a99af9d591560 Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 20:06:50 -0700 Subject: [PATCH 4/8] fix: correct generate_feeds config and add caching to GitHub Actions - Fix typo in config.toml: generate_feed -> generate_feeds - Add Nix store caching to speed up CI builds - Add flake inputs caching for faster dependency resolution --- .github/workflows/deploy.yml | 30 +++++++++++++++++++++++------- config.toml | 2 +- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2808628..8a9a37b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,18 +9,34 @@ on: jobs: build-and-deploy: runs-on: ubuntu-latest - + steps: - name: Checkout repository uses: actions/checkout@v4 - + - name: Install Nix uses: cachix/install-nix-action@v31 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | experimental-features = nix-command flakes - + + - name: Setup Nix store cache + uses: actions/cache@v4 + with: + path: /nix/store + key: ${{ runner.os }}-nix-store-${{ hashFiles('**/flake.lock') }} + restore-keys: | + ${{ runner.os }}-nix-store- + + - name: Cache flake inputs + uses: actions/cache@v4 + with: + path: ~/.cache/nix + key: ${{ runner.os }}-nix-flake-${{ hashFiles('**/flake.lock') }} + restore-keys: | + ${{ runner.os }}-nix-flake- + - name: Build site (pull request) if: github.event_name == 'pull_request' run: | @@ -29,7 +45,7 @@ jobs: nix build nix flake show ls result - + - name: Deploy to Cloudflare Pages (pull request) if: github.event_name == 'pull_request' run: | @@ -37,16 +53,16 @@ jobs: env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - + - name: Build site (main branch) if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: | nix build - + - name: Deploy to Cloudflare Pages (main branch) if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: | nix develop --command wrangler pages deploy result --project-name=softinio --commit-dirty=true env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} \ No newline at end of file + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} diff --git a/config.toml b/config.toml index e72644c..899e592 100644 --- a/config.toml +++ b/config.toml @@ -3,7 +3,7 @@ theme = "tabi" title = "Salar Rahmanian" description = "Software Engineer based in San Francisco Bay Area" author = "Salar Rahmanian" -generate_feed = true +generate_feeds = true compile_sass = true minify_html = true build_search_index = true From 3f58710a71beb9d1a5687168fc5521533ff8bec9 Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 21:24:28 -0700 Subject: [PATCH 5/8] remove extra nix config from ci --- .github/workflows/deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8a9a37b..38ccd7d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,8 +18,6 @@ jobs: uses: cachix/install-nix-action@v31 with: nix_path: nixpkgs=channel:nixos-unstable - extra_nix_config: | - experimental-features = nix-command flakes - name: Setup Nix store cache uses: actions/cache@v4 From 3b0d04f127a81ca97e09cdf82236dbf05a7709fb Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 21:25:56 -0700 Subject: [PATCH 6/8] revert: restore flake.lock to previous version Revert the flake update from commit c827644 to fix build issues --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 469c98d..cf55e4b 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1749285348, - "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", + "lastModified": 1707956935, + "narHash": "sha256-ZL2TrjVsiFNKOYwYQozpbvQSwvtV/3Me7Zwhmdsfyu4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", + "rev": "a4d4fe8c5002202493e87ec8dbc91335ff55552c", "type": "github" }, "original": { From dde3d49aae9b310a6eb81ac5539870e9917500d4 Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 21:36:55 -0700 Subject: [PATCH 7/8] correction to preview url for deployment --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 38ccd7d..4058488 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,7 +39,7 @@ jobs: if: github.event_name == 'pull_request' run: | # Update base URL for PR preview - sed -i "s|base_url = \"https://www.softinio.com\"|base_url = \"https://${{ github.head_ref }}.softinio.com\"|" ./config.toml + sed -i "s|base_url = \"https://www.softinio.com\"|base_url = \"https://${{ github.head_ref }}.softinio.pages.dev\"|" ./config.toml nix build nix flake show ls result From 6c7405a63bb1d297f19dbda46b1a76accdabb321 Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 13 Jun 2025 21:41:15 -0700 Subject: [PATCH 8/8] feat: add preview URL output to GitHub Actions workflow Display the preview URL in build logs for easier access during PR reviews --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4058488..e485e37 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,6 +43,7 @@ jobs: nix build nix flake show ls result + echo "Preview URL: https://${{ github.head_ref }}.softinio.pages.dev" - name: Deploy to Cloudflare Pages (pull request) if: github.event_name == 'pull_request'