---
  name: Release Please
  on:
    push:
      branches:
        - main
    workflow_dispatch:

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

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

        - name: Configure AWS Credentials
          uses: aws-actions/configure-aws-credentials@v5
          with:
            aws-region: us-west-2
            role-to-assume: ${{ secrets.SECRETS_AWS_PACKAGING_ROLE_TO_ASSUME }}
            role-duration-seconds: 900
            role-session-name: ${{ github.run_id }}

        - name: Get git credentials
          uses: aws-actions/aws-secretsmanager-get-secrets@v2
          with:
            parse-json-secrets: true
            secret-ids: |
              ${{ secrets.OSDS_PACKAGING_ROLE }}

        - name: Run release-please
          uses: googleapis/release-please-action@v4
          with:
            release-type: node
            token: ${{ env.OSDS_ACCESS_TOKEN }}
            config-file: release-please-config.json
            manifest-file: .release-please-manifest.json
