obsidian-cli-inspector 1.0.3

Local-first CLI/TUI for indexing and querying Obsidian vaults
Documentation
name: Release

on:
  push:
    branches:
      - master
      - alpha

concurrency:
  group: release-${{ github.ref }}
  cancel-in-progress: false

jobs:
  release:
    name: Release Please
    runs-on: ubuntu-latest

    permissions:
      contents: write
      pull-requests: write
      issues: write

    outputs:
      release_created: ${{ steps.release.outputs.release_created }}
      tag_name: ${{ steps.release.outputs.tag_name }}

    steps:
      - name: Run release-please
        id: release
        uses: googleapis/release-please-action@v4
        with:
          token : ${{ secrets.RELEASE_TOKEN }}
          config-file: .release-please-config.json
          manifest-file: .release-please-manifest.json

  crate-publish:
    name: Publish to crates.io
    needs: release
    if: ${{ needs.release.outputs.release_created == 'true' && github.ref == 'refs/heads/master' }}
    runs-on: ubuntu-latest

    permissions:
      contents: read

    steps:
      - name: Checkout repo at release tag
        uses: actions/checkout@v4
        with:
          ref: ${{ needs.release.outputs.tag_name }}

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

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

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

  aur-build:
    name: Build AUR Package
    needs: [release, crate-publish]
    if: ${{ needs.release.outputs.release_created == 'true' && github.ref == 'refs/heads/master' && !contains(github.event.pull_request.labels.*.name, 'autorelease:pending') }}
    uses: ./.github/workflows/aur-build.yml
    with:
      ref: ${{ needs.release.outputs.tag_name }}
      version: ${{ needs.release.outputs.tag_name }}

  aur-unstable-publish:
    name: Publish Unstable to AUR (-git)
    if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
    runs-on: ubuntu-latest

    steps:
      - name: Checkout master
        uses: actions/checkout@v4
        with:
          ref: master
          fetch-depth: 0

      - name: Generate PKGBUILD for git variant
        shell: bash
        run: |
          set -euo pipefail
          cd aur
          chmod +x generate-pkgbuild-git.sh
          make -f Makefile.git all

      - name: Verify artifacts
        shell: bash
        run: |
          set -euo pipefail
          test -f aur/PKGBUILD || (echo "PKGBUILD missing" && exit 1)
          test -f aur/.SRCINFO || (echo ".SRCINFO missing" && exit 1)

      - name: PKGBUILD syntax check
        shell: bash
        run: |
          set -euo pipefail
          docker run --rm             -v "${GITHUB_WORKSPACE}:/work"             -w /work/aur             archlinux:latest bash -lc '
              set -euo pipefail
              pacman -Sy --noconfirm --needed base-devel cargo git >/dev/null
              useradd -m builder
              chown -R builder:builder /work
              su builder -s /bin/bash -c "cd /work/aur && makepkg --check"
            '

      - name: Publish to AUR (-git)
        uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
        with:
          pkgname: obsidian-cli-inspector-git
          pkgbuild: ./aur/PKGBUILD
          commit_username: ${{ secrets.AUR_USERNAME }}
          commit_email: ${{ secrets.AUR_EMAIL }}
          ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
          commit_message: "Update unstable git version from ${{ github.sha }}"
          ssh_keyscan_types: rsa,ecdsa,ed25519

  aur-stable-publish:
    name: AUR stable publish
    needs: [release, aur-build]
    if: ${{ needs.release.outputs.release_created == 'true' && github.ref == 'refs/heads/master' }}
    runs-on: ubuntu-latest

    steps:
      - name: Checkout release tag
        uses: actions/checkout@v4
        with:
          ref: ${{ needs.release.outputs.tag_name }}

      - name: Download PKGBUILD artifacts
        uses: actions/download-artifact@v4
        with:
          name: aur-package
          path: aur/

      - name: Extract version from tag
        id: version
        run: |
          VERSION=${{ needs.release.outputs.tag_name }}
          VERSION=${VERSION#v}
          echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

      - name: Publish to AUR
        uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
        with:
          pkgname: obsidian-cli-inspector
          pkgbuild: ./aur/PKGBUILD
          commit_username: ${{ secrets.AUR_USERNAME }}
          commit_email: ${{ secrets.AUR_EMAIL }}
          ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
          commit_message: "Update to ${{ steps.version.outputs.VERSION }}"
          ssh_keyscan_types: rsa,ecdsa,ed25519