name: release
on:
  push:
    branches:
      - 'main'

permissions:
  pull-requests: write
  contents: write
  id-token: write
  attestations: write

jobs:
  release-plz:
    name: Release-plz
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
        with:
          fetch-depth: 0

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
          profile: minimal

      - name: Run release-plz
        id: release-plz
        uses: MarcoIeni/release-plz-action@v0.5
        env:
          GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_PAT }}
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

      - uses: actions/attest-build-provenance@v3
        with:
          subject-path: ${{ github.workspace }}/target/release/photo_sort
        continue-on-error: true
