rs-matter-stack 0.2.0

Utility for configuring and running rs-matter
Documentation
name: Publish

on: workflow_dispatch

env:
  RUST_TOOLCHAIN: stable
  CRATE_NAME: rs-matter-stack

jobs:
  publish:
    name: Publish
    runs-on: ubuntu-latest
    # `contents: write` is required so the "Tag the new release" step can push
    # the git tag. The default GITHUB_TOKEN is read-only for repos/orgs whose
    # default workflow permissions are "read", which is why tagging fails today.
    permissions:
      contents: write
    steps:
      - name: Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          components: rustfmt, clippy, rust-src

      - name: Install libdbus
        run: sudo apt-get update -y; sudo apt-get install -y libdbus-1-dev

      - name: Checkout
        uses: actions/checkout@v4

      - name: Login
        run: cargo login ${{ secrets.CRATES_IO_TOKEN }}

      - name: Publish
        run: cargo publish

      - name: Get the crate version from cargo
        run: |
          version=$(cargo metadata --format-version=1 --no-deps | jq -r ".packages[] | select(.name == \"${{env.CRATE_NAME}}\") | .version")
          echo "crate_version=$version" >> $GITHUB_ENV
          echo "${{env.CRATE_NAME}} version: $version"

      - name: Tag the new release
        uses: rickstaa/action-create-tag@v1
        with:
          tag: v${{env.crate_version}}
          message: "Release v${{env.crate_version}}"