name: Sync Monorepo Dev-Master

on:
  push:
    branches:
      - master

jobs:
  provide_packages_json:
    runs-on: ubuntu-20.04

    steps:
      -
        uses: actions/checkout@v2

      # required for matrix of packages set
      -   uses: shivammathur/setup-php@v2
          with:
            php-version: 7.4
            coverage: none

      -   uses: "ramsey/composer-install@v1"

      - name: Install Monorepo-Builder
        run: composer require symplify/monorepo-builder:^9.0 --update-no-dev

      # get package json list
      -
        id: output_data
        run: echo "::set-output name=matrix::$(packages/monorepo-builder/bin/monorepo-builder packages-json)"

    # this step is needed, so the output gets to the next defined job
    outputs:
      matrix: ${{ steps.output_data.outputs.matrix }}

  split_monorepo:
    needs: provide_packages_json

    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        package: ${{fromJson(needs.provide_packages_json.outputs.matrix)}}

    steps:
      -
        uses: actions/checkout@v2

      -
        # Uses an action in the root directory
        name: Monorepo Split of ${{ matrix.package }}
        uses: symplify/monorepo-split-github-action@1.1
        env:
          GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        with:
          package-directory: 'packages/${{ matrix.package }}'
          split-repository-organization: 'thegreenter'
          split-repository-name: '${{ matrix.package }}'
          user-name: "giansalex"
          user-email: "giansalex@gmail.com"
          branch: "master"
Add monorepo dev-master sync workflow
Add monorepo dev-master sync workflow
