ehatrom 0.3.3

EEPROM HAT library for Raspberry Pi HATs (serialization, I2C, CRC32, custom atoms)
Documentation
name: Publish to crates.io

# This workflow publishes the crate to crates.io when a new tag is pushed
# Requirements:
# - Tag must start with 'v' (e.g., v0.3.1)
# - CRATES_IO_TOKEN must be set in the repository secrets
#   (Settings > Secrets and variables > Actions)

on:
  push:
    tags:
      - 'v*'

jobs:
  publish:
    name: Publish
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      
      # Check if CRATES_IO_TOKEN secret is available
      # This step will fail if the secret is not set
      - name: Validate crates.io token
        run: |
          if [ -z "${CARGO_REGISTRY_TOKEN}" ]; then
            echo "::error::CRATES_IO_TOKEN is not set in GitHub repository secrets"
            echo "Please add CRATES_IO_TOKEN in repository Settings > Secrets and variables > Actions"
            exit 1
          else
            echo "Crates.io token is configured correctly"
          fi
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
      
      - name: Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
        run: cargo publish