v4.0.7 #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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: "[email protected]" | |
branch: "main" |