indxdb 0.12.0

A key-value database engine abstraction layer for IndexedDB running in WASM
Documentation
name: Release

run-name: "Release run '${{ github.head_ref || github.ref_name }}'"

on:
  workflow_dispatch:

jobs:
  semver:
    name: semver
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Check semver
        uses: obi1kenobi/cargo-semver-checks-action@v2

  release:
    name: Process Release
    runs-on: ubuntu-latest
    needs: semver
    permissions:
      contents: write  # required for creating tags and GitHub releases
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}

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

      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2

      - name: Install a TOML parser
        run: |
          curl -L https://github.com/tamasfe/taplo/releases/download/0.8.1/taplo-full-linux-x86_64.gz | gunzip - > taplo
          chmod +x taplo
          sudo mv taplo /usr/bin/taplo

      - name: Configure git
        run: |
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git config user.name "github-actions[bot]"
          git config --add --bool push.autoSetupRemote true

      - name: Extract version from branch name
        id: version
        run: |
          BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
          VERSION="${BRANCH_NAME#release/}"
          echo "Version from branch: $VERSION"
          
          # Validate version matches Cargo.toml
          CARGO_VERSION=$(taplo get -f Cargo.toml "package.version")
          if [ "$VERSION" != "$CARGO_VERSION" ]; then
            echo "Error: Branch version ($VERSION) doesn't match Cargo.toml version ($CARGO_VERSION)"
            exit 1
          fi
          
          echo "version=$VERSION" >> $GITHUB_OUTPUT

      - name: Create and push tag
        run: |
          git tag -a "v${{ steps.version.outputs.version }}" -m "Release version ${{ steps.version.outputs.version }}"
          git push origin "v${{ steps.version.outputs.version }}"

      - name: Publish crate
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          tag_name: v${{ steps.version.outputs.version }}
          name: Release ${{ steps.version.outputs.version }}
          draft: false
          prerelease: false