mooxphp/moox

View on GitHub
.github/workflows/monorepo-split-packages.yml

Summary

Maintainability
Test Coverage
name: "Split Packages"

on:
  push:
    branches:
      - main

env:
  GITHUB_TOKEN: ${{ secrets.BOT }}
  CORE_VERSION: "^2.1.3"

jobs:
  packages_split:
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        package:
          - audit
          - builder
          - core
          - expiry
          - flags
          - jobs
          - locate
          - login-link
          - notifications
          - passkey
          - permission
          - press
          - security
          - sync
          - redis-model
          - trainings
          - user
          - user-device
          - user-session

    steps:
      - uses: actions/checkout@v4

     # Search and replace "moox/core": "*" with "moox/core": "^2.1.3" in composer.json
      - name: Replace core version in composer.json
        working-directory: packages/${{ matrix.package }}
        run: |
          if [ -f composer.json ]; then
            echo "Updating moox/core version in ${{ matrix.package }}"
            sed -i 's/"moox\/core": "\*"/"moox\/core": "^2.1.3"/g' composer.json
          fi

      # Commit the updated composer.json (if there was a change)
      - name: Commit changes
        working-directory: packages/${{ matrix.package }}
        run: |
          if [ -f composer.json ]; then
            git config --global user.name "mooxbot"
            git config --global user.email "bot@moox.org"
            git add composer.json
            git commit -m "Update moox/core dependency to ^^2.1.3" || echo "No changes to commit"
          fi

      - if: "!startsWith(github.ref, 'refs/tags/')"
        uses: "symplify/monorepo-split-github-action@v2.3.0"
        with:
          tag: ${GITHUB_REF#refs/tags/}

          package_directory: "packages/${{ matrix.package }}"

          repository_organization: "mooxphp"
          repository_name: "${{ matrix.package }}"

          user_name: "mooxbot"
          user_email: "bot@moox.org"