-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (56 loc) · 2.07 KB
/
split-monorepo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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"