-
Notifications
You must be signed in to change notification settings - Fork 5
88 lines (74 loc) · 2.55 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
78
79
80
81
82
83
84
85
86
87
88
name: Split Monorepo
on:
push:
branches:
- main
- '*.x'
- '*.*.x'
tags:
- 'v*.*.*'
jobs:
provide_packages_json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# required for matrix of packages set
- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
- uses: "ramsey/composer-install@v3"
# 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-latest
strategy:
fail-fast: false
matrix:
package: ${{fromJson(needs.provide_packages_json.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
# no tag
-
if: "!startsWith(github.ref, 'refs/tags/')"
# Uses an action in the root directory
name: Monorepo Split of ${{ matrix.package }}
uses: symplify/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
package_directory: 'src/mantle/${{ matrix.package }}'
repository_organization: 'mantle-framework'
repository_name: '${{ matrix.package }}'
repository_host: github.com
user_name: "mantle-ci"
user_email: "[email protected]"
branch: ${{ github.ref_name }}
# with tag
-
if: "startsWith(github.ref, 'refs/tags/')"
name: "Extract branch name"
id: extract-branch-name
run: echo "branch=$(git branch -a --contains ${{ github.sha }} | grep -v 'HEAD' | sed -n 2p | awk '{ printf $1 }' | sed 's/remotes\/origin\///g')" >> $GITHUB_OUTPUT
-
if: "startsWith(github.ref, 'refs/tags/')"
# Uses an action in the root directory
name: Monorepo Tagged Split of ${{ matrix.package }}
uses: symplify/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
tag: ${GITHUB_REF#refs/tags/}
package_directory: 'src/mantle/${{ matrix.package }}'
repository_organization: 'mantle-framework'
repository_name: '${{ matrix.package }}'
repository_host: "github.com"
user_name: "mantle-ci"
user_email: "[email protected]"
branch: ${{ steps.extract-branch-name.outputs.branch }}