name: Publish Docker image for release candidate

on:
  push:
    tags:
      - "*.*.*-rc*"
      - "!*-*-rc*"

permissions:
  contents: read
  packages: write

jobs:
  docker_publish:
    uses: ./.github/workflows/docker.yml
    with:
      add_latest: true
    secrets:
      DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME_2 }}
      DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD_2 }}

  discord_notification:
    needs: docker_publish
    uses: ./.github/workflows/discord.yml
    with:
      discord_title: "New Release Candidate: ${{ github.ref_name }}"
      discord_color: 2044800
      discord_footer: "Portabase"
    secrets:
      DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
