cluster-api-rs 1.12.5

Cluster API structures generated by kopium from upstream CRDs
Documentation
name: Updatecli

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Specific version to publish. Leave empty to auto-determine latest version.'
        required: false
        default: ''
      dry_run:
        description: 'Run cargo publish in dry-run mode?'
        required: true
        default: true
        type: boolean
  schedule:
    # Run once a day
    - cron: '0 0 * * *'

permissions:
  contents: write
  pull-requests: write

jobs:
  crates_io_publish:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable

      - name: Install Updatecli in the runner
        uses: updatecli/updatecli-action@v2

      - name: Install just
        uses: extractions/setup-just@v4

      - name: Update changes
        id: update
        env:
          GITHUB_USER: "github-action"
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        run: |
          git config --local user.email "49699333+dependabot[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          if [ -z "${{ github.event.inputs.version }}" ]; then
            echo "No version provided, updating to latest version."
            before=$(just current-version ".cluster_api.tag")
            echo "Current version: $before"
            just generate-and-commit
            after=$(just current-version ".cluster_api.tag")
            echo "New version: $after"
            if [[ "${before}" != "${after}" ]]; then
              cargo build
              echo publish=true >> $GITHUB_OUTPUT
              git push
            fi
          else
            echo "Using provided version: ${{ github.event.inputs.version }}"
            just generate-manual ${{ github.event.inputs.version }}
            cargo build
            git diff
            echo publish=true >> $GITHUB_OUTPUT
          fi

      - uses: dtolnay/rust-toolchain@stable
        if: steps.update.outputs.publish == 'true'

      - name: cargo login
        if: steps.update.outputs.publish == 'true'
        run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}

      - name: cargo publish
        if: steps.update.outputs.publish == 'true'
        run: |
          if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then
            cargo publish --all-features --dry-run --allow-dirty
          else
            cargo publish --all-features --allow-dirty
          fi