firo_logger 1.1.2

A high-performance, feature-rich logger for Rust applications with colored output, structured logging, and advanced configuration
Documentation
name: Release

on:
  push:
    tags:
      - "v*"

env:
  CARGO_TERM_COLOR: always

permissions:
  contents: write # To create releases
  packages: write # If publishing to GitHub packages
  actions: read

jobs:
  wait-for-ci:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - name: Wait for Quick Check to complete
        uses: lewagon/wait-on-check-action@v1.3.4
        with:
          ref: ${{ github.sha }}
          check-name: "Quick Check"
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          wait-interval: 10
          allowed-conclusions: success,skipped,cancelled

      - name: Wait for Format & Lint to complete
        uses: lewagon/wait-on-check-action@v1.3.4
        with:
          ref: ${{ github.sha }}
          check-name: "Format & Lint"
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          wait-interval: 10
          allowed-conclusions: success,skipped,cancelled

  release:
    name: Release to crates.io
    runs-on: ubuntu-latest
    needs: wait-for-ci

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache dependencies
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-

      - name: Verify version matches tag
        run: |
          CARGO_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
          TAG_VERSION=${GITHUB_REF_NAME#v}
          if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
            echo "❌ Version mismatch: Cargo.toml has $CARGO_VERSION but tag is $TAG_VERSION"
            exit 1
          fi
          echo "✅ Version verified: $CARGO_VERSION"

      - name: Verify package
        run: cargo package --list

      - name: Dry run publish
        run: cargo publish --dry-run

      - name: Publish to crates.io
        run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          name: Release ${{ github.ref_name }}
          generate_release_notes: true
          draft: false
          prerelease: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Notify success
        if: success()
        run: |
          echo "🎉 Successfully published firo_logger ${{ github.ref_name }} to crates.io!"
          echo "📦 Available at: https://crates.io/crates/firo_logger"
          echo "📚 Documentation: https://docs.rs/firo_logger"

      - name: Notify failure
        if: failure()
        run: |
          echo "❌ Release failed for ${{ github.ref_name }}"
          echo "Please check the logs and try again."