name: "NATS Server Nightly: DEV"
on:
  workflow_dispatch:
    inputs:
      target:
        description: "Override image branch (optional)"
        type: string
        required: false

  schedule:
    - cron: "40 4 * * *"

jobs:
  nightly_release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          path: src/github.com/nats-io/nats-server
          ref: ${{ inputs.target || 'main' }}

      - uses: ./src/github.com/nats-io/nats-server/.github/actions/nightly-release
        with:
          go: "1.21"
          workdir: src/github.com/nats-io/nats-server
          label: nightly
          hub_username: "${{ secrets.DOCKER_USERNAME }}"
          hub_password: "${{ secrets.DOCKER_PASSWORD }}"
