winx-code-agent 0.2.332

High-performance Rust implementation of WCGW for LLM code agents
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

permissions:
  contents: write

jobs:
  quality:
    uses: ./.github/workflows/ci.yml

  build:
    name: Build Release
    needs: quality
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            asset_name: winx-linux-amd64.tar.gz
            bundle: true
          - os: macos-latest
            asset_name: winx-macos-arm64.tar.gz
            bundle: true
          - os: windows-latest
            asset_name: winx-windows-amd64.exe
            bundle: false

    steps:
      - uses: actions/checkout@v7

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

      - name: Rust Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.os }}-release

      - name: Build Unix release bundle
        if: matrix.bundle
        run: cargo build --release --locked --bins

      - name: Build Windows standalone binary
        if: ${{ !matrix.bundle }}
        run: cargo build --release --locked --bin winx-code-agent

      - name: Stage Unix release bundle
        if: matrix.bundle
        shell: bash
        run: |
          mkdir -p dist/stage
          cp target/release/winx-code-agent target/release/winxd target/release/winx-guardian dist/stage/
          tar -C dist/stage -czf "dist/${{ matrix.asset_name }}" winx-code-agent winxd winx-guardian

      - name: Stage Windows standalone binary
        if: ${{ !matrix.bundle }}
        shell: bash
        run: |
          mkdir -p dist
          cp target/release/winx-code-agent.exe "dist/${{ matrix.asset_name }}"

      - name: Upload artifact
        uses: actions/upload-artifact@v6
        with:
          name: ${{ matrix.asset_name }}
          path: dist/${{ matrix.asset_name }}
          retention-days: 5

  publish:
    name: Publish to crates.io
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

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

      - name: Rust Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: publish

      - name: Verify tag matches Cargo.toml
        run: |
          CARGO_VERSION=$(grep -m1 '^version = ' Cargo.toml | cut -d '"' -f2)
          TAG_VERSION="${GITHUB_REF#refs/tags/v}"
          if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
            echo "::error::Cargo.toml version ($CARGO_VERSION) != tag ($TAG_VERSION)"
            exit 1
          fi
          echo "version=$CARGO_VERSION" >> "$GITHUB_ENV"

      - name: Skip if version already on crates.io
        id: check
        run: |
          status=$(curl -sf -A "winx-ci/1.0" \
            "https://crates.io/api/v1/crates/winx-code-agent/${{ env.version }}" \
            -o /dev/null -w "%{http_code}" || true)
          if [ "$status" = "200" ]; then
            echo "winx-code-agent ${{ env.version }} already exists on crates.io — skipping"
            echo "skip=true" >> "$GITHUB_OUTPUT"
          else
            echo "skip=false" >> "$GITHUB_OUTPUT"
          fi

      - name: Cargo publish
        if: steps.check.outputs.skip != 'true'
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
        run: cargo publish --locked

  release:
    name: Publish GitHub Release
    needs: [build, publish]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

      - name: Download all artifacts
        uses: actions/download-artifact@v6
        with:
          path: dist
          merge-multiple: true

      - name: Publish release
        uses: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.ref_name }}
          name: ${{ github.ref_name }}
          generate_release_notes: true
          fail_on_unmatched_files: true
          files: dist/*