diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e485e37 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,67 @@ +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 + + - 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: | + # Update base URL for PR preview + 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 + echo "Preview URL: https://${{ github.head_ref }}.softinio.pages.dev" + + - 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 }} 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/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 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 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