giansalex/greenter

View on GitHub
.github/workflows/monorepo_split_dev.yml

Summary

Maintainability
Test Coverage
name: Sync Monorepo Dev-Master

on:
  workflow_dispatch:
#  push:
#    branches:
#      - master

jobs:
  provide_packages_json:
    runs-on: ubuntu-22.04

    steps:
      - uses: actions/checkout@v2

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

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

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

      # get package json list
      - id: output_data
        run: echo "matrix=$(vendor/bin/monorepo-builder packages-json)" >> $GITHUB_OUTPUT

    # 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-22.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@v2.3.0
        env:
          GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        with:
          package_directory: 'packages/${{ matrix.package }}'
          repository_organization: 'thegreenter'
          repository_name: '${{ matrix.package }}'
          user_name: "giansalex"
          user_email: "me@giansalex.dev"
          branch: "master"