name: Sync to Maven Central
description: 'Syncs a release to Maven Central and waits for it to be available for use'
inputs:
  central-token-password:
    description: 'Password for authentication with central.sonatype.com'
    required: true
  central-token-username:
    description: 'Username for authentication with central.sonatype.com'
    required: true
  jfrog-cli-config-token:
    description: 'Config token for the JFrog CLI'
    required: true
  spring-ws-version:
    description: 'Version of Spring Web Services that is being synced to Central'
    required: true
runs:
  using: composite
  steps:
    - name: Set Up JFrog CLI
      uses: jfrog/setup-jfrog-cli@f748a0599171a192a2668afee8d0497f7c1069df # v4.5.6
      env:
        JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }}
    - name: Download Release Artifacts
      shell: bash
      run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('spring-ws-{0}', inputs.spring-ws-version) }};buildNumber=${{ github.run_number }}'
    - name: Sync
      uses: spring-io/nexus-sync-action@476a41fc5497ba0a3ad6aa179b685486fc62730a # v0.1.1
      with:
        token: ${{ inputs.central-token-password }}
        token-name: ${{ inputs.central-token-username }}
    - name: Await
      uses: ./.github/actions/await-http-resource
      with:
        url: ${{ format('https://repo.maven.apache.org/maven2/org/springframework/ws/spring-ws-core/{0}/spring-ws-core-{0}.jar', inputs.spring-ws-version) }}
