@@ -2,102 +2,72 @@ name: split-monorepo
22on :
33 release :
44 types : [published]
5+ workflow_dispatch :
6+ inputs :
7+ tag :
8+ description : ' Package tag'
9+ type : string
10+ required : true
511
612jobs :
7- split-hook-dd-trace :
13+ split-repositories :
814 runs-on : ubuntu-latest
15+ strategy :
16+ matrix :
17+ # Structure of the config tuple is:
18+ # 0: Type of package (e.g. open-feature/flagd-*provider*)
19+ # 1: Name of package (sans-org-prefix e.g. open-feature/*flagd*-provider)
20+ # 2: Name of subdirectory (e.g. providers/*Flagd*)
21+ config :
22+ - [hook, dd-trace, DDTrace]
23+ - [hook, otel, OpenTelemetry]
24+ - [hook, validator, Validators]
25+ - [provider, cloudbees, CloudBees]
26+ - [provider, flagd, Flagd]
27+ - [provider, split, Split]
28+ - [provider, go-feature-flag, GoFeatureFlag]
929 steps :
30+ - name : Detect run requirement
31+ id : shouldRun
32+ run : |
33+ input_ref="${{ github.event.release.tag_name }}"
34+ if [ -z "$input_ref" ]; then
35+ input_ref="${{ inputs.tag }}"
36+ fi
37+ result=0
38+ if [[ "$inputRef" == open-feature/${{ matrix.config[1] }}-${{ matrix.config[0] }}-* ]]; then
39+ result=1
40+ fi
41+ echo "::set-output name=result::${result}"
1042 - name : checkout
11- run : git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA"
12- - name : push-hook-dd-trace
13- uses : tcarrio/git-filter-repo-docker-action@v1
43+ if : ${{ steps.shouldRun.outputs.result == '1' }}
44+ run : |
45+ git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE"
46+ cd "$GITHUB_WORKSPACE"
47+ git checkout "$GITHUB_SHA"
48+ - name : Replace string in GitHub Actions
49+ if : ${{ steps.shouldRun.outputs.result == '1' }}
50+ id : targetRef
51+ run : |
52+ input_ref="${{ github.event.release.tag_name }}"
53+ if [ -z "$input_ref" ]; then
54+ input_ref="${{ inputs.tag }}"
55+ fi
56+ if [ -n "$input_ref" ]; then
57+ input_ref="refs/tags/$input_ref"
58+ target_ref="$(echo -n "$input_ref"|sed 's#open-feature/${{ matrix.config[1] }}-${{ matrix.config[0] }}-##')"
59+ fi
60+ echo "::set-output name=result::${target_ref}"
61+ - name : Filter and push package ${{ matrix.config[1] }}-${{ matrix.config[0] }}
62+ if : ${{ steps.shouldRun.outputs.result == '1' }}
63+ 1464 with :
1565 privateKey : ${{ secrets.SSH_PRIVATE_KEY }}
1666 targetOrg : open-feature-php
17- targetRepo : dd-trace-hook
18- targetBranch : refs/tags/${{ github.event.release.tag_name }}
19- filterArguments : ' --subdirectory-filter hooks/DDTrace/ --force'
20-
21- split-hook-otel :
22- runs-on : ubuntu-latest
23- steps :
24- - name : checkout
25- run : git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA"
26- - name : push-hook-otel
27- uses : tcarrio/git-filter-repo-docker-action@v1
28- with :
29- privateKey : ${{ secrets.SSH_PRIVATE_KEY }}
30- targetOrg : open-feature-php
31- targetRepo : otel-hook
32- targetBranch : refs/tags/${{ github.event.release.tag_name }}
33- filterArguments : ' --subdirectory-filter hooks/OpenTelemetry/ --force'
34-
35- split-hook-validator :
36- runs-on : ubuntu-latest
37- steps :
38- - name : checkout
39- run : git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA"
40- - name : push-hook-validator
41- uses : tcarrio/git-filter-repo-docker-action@v1
42- with :
43- privateKey : ${{ secrets.SSH_PRIVATE_KEY }}
44- targetOrg : open-feature-php
45- targetRepo : validators-hook
46- targetBranch : refs/tags/${{ github.event.release.tag_name }}
47- filterArguments : ' --subdirectory-filter hooks/Validators/ --force'
48-
49- split-provider-cloudbees :
50- runs-on : ubuntu-latest
51- steps :
52- - name : checkout
53- run : git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA"
54- - name : push-provider-cloudbees
55- uses : tcarrio/git-filter-repo-docker-action@v1
56- with :
57- privateKey : ${{ secrets.SSH_PRIVATE_KEY }}
58- targetOrg : open-feature-php
59- targetRepo : cloudbees-provider
60- targetBranch : refs/tags/${{ github.event.release.tag_name }}
61- filterArguments : ' --subdirectory-filter providers/CloudBees/ --force'
62-
63- split-provider-flagd :
64- runs-on : ubuntu-latest
65- steps :
66- - name : checkout
67- run : git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA"
68- - name : push-provider-flagd
69- uses : tcarrio/git-filter-repo-docker-action@v1
70- with :
71- privateKey : ${{ secrets.SSH_PRIVATE_KEY }}
72- targetOrg : open-feature-php
73- targetRepo : flagd-provider
74- targetBranch : refs/tags/${{ github.event.release.tag_name }}
75- filterArguments : ' --subdirectory-filter providers/Flagd/ --force'
76-
77- split-provider-split :
78- runs-on : ubuntu-latest
79- steps :
80- - name : checkout
81- run : git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA"
82- - name : push-provider-split
83- uses : tcarrio/git-filter-repo-docker-action@v1
84- with :
85- privateKey : ${{ secrets.SSH_PRIVATE_KEY }}
86- targetOrg : open-feature-php
87- targetRepo : split-provider
88- targetBranch : refs/tags/${{ github.event.release.tag_name }}
89- filterArguments : ' --subdirectory-filter providers/Split/ --force'
90-
91- split-provider-go-feature-flag :
92- runs-on : ubuntu-latest
93- steps :
94- - name : checkout
95- run : git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA"
96- - name : push-provider-split
97- uses : tcarrio/git-filter-repo-docker-action@v1
98- with :
99- privateKey : ${{ secrets.SSH_PRIVATE_KEY }}
100- targetOrg : open-feature-php
101- targetRepo : go-feature-flag-provider
102- targetBranch : refs/tags/${{ github.event.release.tag_name }}
103- filterArguments : ' --subdirectory-filter providers/GoFeatureFlag/ --force'
67+ targetRepo : ${{ matrix.config[1] }}-${{ matrix.config[0] }}
68+ targetBranch : ${{ steps.targetRef.outputs.result }}
69+ tagFilter : ^open-feature/${{ matrix.config[1] }}-
70+ filterArguments : |
71+ --subdirectory-filter "${{matrix.config[0] }}s/${{ matrix.config[2] }}/" \
72+ --tag-rename "open-feature/${{ matrix.config[1] }}-${{ matrix.config[0] }}-:" \
73+ --force
0 commit comments