name: "CI-RELEASE"

on:
  release:
    types: [published]

jobs:
  trigger-docker:
    runs-on: ubuntu-latest

    steps:
      - name: Generate a token
        id: generate-token
        uses: actions/create-github-app-token@v2
        with:
          app-id: ${{ vars.RELEASE_DOCKER_ID }}
          private-key: ${{ secrets.RELEASE_DOCKER_SECRET }}

      - uses: peter-evans/repository-dispatch@v4
        with:
          token: ${{ steps.generate-token.outputs.token }}
          repository: Dolibarr/dolibarr-docker
          event-type: new-release
          client-payload: '{"version": "${{ github.event.release.tag_name }}"}'
