drift-rs 1.0.0-alpha.15

Rust SDK for Drift V2 Protocol on the Solana blockchain.
Documentation
name: Release

permissions:
  pull-requests: write
  contents: write

on:
  push:
    tags:
      - 'v[12].[0-9]+.[0-9]+'
      - 'v[12].[0-9]+.[0-9]+-alpha.[0-9]+'

jobs:
  crates-io:
    name: Publish to crates.io
    runs-on: ubicloud
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1
          submodules: true
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
      - name: install 1.76.0 toolchain
        run: |
          rustup install 1.76.0-x86_64-unknown-linux-gnu
      - name: Cargo login
        run: |
          cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
      - name: Publish drift-idl-gen
        run: |
          cd crates/drift-idl-gen
          cargo publish || true
      - name: Publish drift-pubsub-client
        run: |
          cd crates/pubsub-client
          cargo publish || true
      - name: Publish drift-rs
        run: |
          # add libdrift_ffi_sys
          FFI_VERSION=$(grep '^version = ' crates/drift-ffi-sys/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
          curl -L https://github.com/drift-labs/drift-ffi-sys/releases/download/v$FFI_VERSION/libdrift_ffi_sys.so > libdrift_ffi_sys.so
          sudo mv libdrift_ffi_sys.so $CARGO_DRIFT_FFI_PATH
          # publish to crates.io
          cargo -V
          cargo publish
        env:
          CARGO_DRIFT_FFI_PATH: "/usr/lib"

  notify-downstream-repos:
    needs: crates-io
    runs-on: ubuntu-latest
    strategy:
      matrix:
        repo: ['gateway', 'swift']
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1
          submodules: true
      - name: Notify repository
        run: |
          # Extract libdrift-ffi-sys version
          FFI_VERSION=$(grep '^version = ' crates/drift-ffi-sys/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
          # Extract release tag (removes 'refs/tags/' prefix)
          TAG=${GITHUB_REF#refs/tags/}
 
          curl -L \
            -X POST \
            -H "Accept: application/vnd.github+json" \
            -H "Authorization: Bearer ${{ secrets.REPO_DISPATCH_TOKEN }}" \
            -H "X-GitHub-Api-Version: 2022-11-28" \
            https://api.github.com/repos/drift-labs/${{ matrix.repo }}/dispatches \
            -d "{\"event_type\":\"drift_rs_release\",\"client_payload\":{\"tag\":\"$TAG\",\"ffi_version\":\"$FFI_VERSION\"}}"