Skip to content

v4.0.4

v4.0.4 #1

Workflow file for this run

name: Split Monorepo
on:
release:
types: [ released ]
env:
GITHUB_TOKEN: ${{ secrets.BUTLER_TOKEN }}
jobs:
provide_packages_json:
# see json juggling: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#example-6
# see https://stackoverflow.com/a/62953566/1348344
runs-on: ubuntu-latest
if: "github.event.release.target_commitish == 'main'"
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
- name: Install Dependencies
uses: ramsey/composer-install@v2
# get package json list
- name: Output list packages as JSON
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-latest
strategy:
fail-fast: false
matrix:
# define package to repository map
package: ${{fromJson(needs.provide_packages_json.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# with tag
- uses: danharrin/monorepo-split-github-action@v2.3.0
name: Monorepo Tagged Split of ${{ matrix.package }}
with:
tag: ${{ github.event.release.tag_name }}
# ↓ split "packages/[local_path]" directory
package_directory: 'packages/${{ matrix.package }}'
# ↓ into charcoalphp/[split_repository] repository
repository_organization: 'charcoalphp'
repository_name: '${{ matrix.package }}'
# [optional, with "github.com" as default]
#repository_host: git.private.com:1234
# ↓ the user signed under the split commit
user_name: "GitHub Action"
user_email: "action@github.com"
branch: "main"