sekuire 0.1.0

The official SDK for the Sekuire Agent Identity Protocol
Documentation
name: Release Rust SDK

on:
  workflow_dispatch:
    inputs:
      bump:
        description: Version bump type
        required: true
        type: choice
        options:
          - patch
          - minor
          - major

permissions:
  contents: write

jobs:
  publish-rust-sdk:
    name: Publish Rust SDK to crates.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: dtolnay/rust-toolchain@stable

      - name: Load secrets from 1Password
        uses: 1password/load-secrets-action@v2
        with:
          export-env: true
        env:
          OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PRODUCTION }}
          CRATES_TOKEN: op://Sekuire Production/Sekuire Release Tokens/CRATES_TOKEN

      - name: Install cargo-edit
        run: cargo install cargo-edit --locked

      - name: Bump Version
        run: |
          cargo set-version --bump ${{ github.event.inputs.bump }}
          NEW_VERSION=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
          echo "CRATE_VERSION=$NEW_VERSION" >> "$GITHUB_ENV"

      - name: Build and Test
        run: |
          cargo build --release
          cargo test

      - name: Commit Version Changes
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add Cargo.toml Cargo.lock
          git commit -m "chore(release): Rust SDK v${{ env.CRATE_VERSION }}"
          git pull --rebase origin "${{ github.ref_name }}"
          git push origin HEAD

      - name: Create Git Tag
        run: |
          git tag -a "rust-sdk-v${{ env.CRATE_VERSION }}" -m "Rust SDK v${{ env.CRATE_VERSION }}"
          git push origin "rust-sdk-v${{ env.CRATE_VERSION }}"

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

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v1
        with:
          tag_name: "rust-sdk-v${{ env.CRATE_VERSION }}"
          name: "Rust SDK v${{ env.CRATE_VERSION }}"
          body: |
            ## Rust SDK Release

            ### Installation

            ```toml
            [dependencies]
            sekuire = "${{ env.CRATE_VERSION }}"
            ```

            ### Validation

            ```bash
            cargo add sekuire@${{ env.CRATE_VERSION }}
            cargo build
            ```
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}