diff --git a/.github/workflows/split_monorepo.yaml b/.github/workflows/split_monorepo.yaml index 4d7e1caf..f51f260f 100644 --- a/.github/workflows/split_monorepo.yaml +++ b/.github/workflows/split_monorepo.yaml @@ -2,102 +2,72 @@ name: split-monorepo on: release: types: [published] + workflow_dispatch: + inputs: + tag: + description: 'Package tag' + type: string + required: true jobs: - split-hook-dd-trace: + split-repositories: runs-on: ubuntu-latest + strategy: + matrix: + # Structure of the config tuple is: + # 0: Type of package (e.g. open-feature/flagd-*provider*) + # 1: Name of package (sans-org-prefix e.g. open-feature/*flagd*-provider) + # 2: Name of subdirectory (e.g. providers/*Flagd*) + config: + - [hook, dd-trace, DDTrace] + - [hook, otel, OpenTelemetry] + - [hook, validator, Validators] + - [provider, cloudbees, CloudBees] + - [provider, flagd, Flagd] + - [provider, split, Split] + - [provider, go-feature-flag, GoFeatureFlag] steps: + - name: Detect run requirement + id: shouldRun + run: | + input_ref="${{ github.event.release.tag_name }}" + if [ -z "$input_ref" ]; then + input_ref="${{ inputs.tag }}" + fi + result=0 + if [[ "$inputRef" == open-feature/${{ matrix.config[1] }}-${{ matrix.config[0] }}-* ]]; then + result=1 + fi + echo "::set-output name=result::${result}" - name: checkout - run: git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA" - - name: push-hook-dd-trace - uses: tcarrio/git-filter-repo-docker-action@v1 + if: ${{ steps.shouldRun.outputs.result == '1' }} + run: | + git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" + cd "$GITHUB_WORKSPACE" + git checkout "$GITHUB_SHA" + - name: Replace string in GitHub Actions + if: ${{ steps.shouldRun.outputs.result == '1' }} + id: targetRef + run: | + input_ref="${{ github.event.release.tag_name }}" + if [ -z "$input_ref" ]; then + input_ref="${{ inputs.tag }}" + fi + if [ -n "$input_ref" ]; then + input_ref="refs/tags/$input_ref" + target_ref="$(echo -n "$input_ref"|sed 's#open-feature/${{ matrix.config[1] }}-${{ matrix.config[0] }}-##')" + fi + echo "::set-output name=result::${target_ref}" + - name: Filter and push package ${{ matrix.config[1] }}-${{ matrix.config[0] }} + if: ${{ steps.shouldRun.outputs.result == '1' }} + uses: tcarrio/git-filter-repo-docker-action@v1.5.0 with: privateKey: ${{ secrets.SSH_PRIVATE_KEY }} targetOrg: open-feature-php - targetRepo: dd-trace-hook - targetBranch: refs/tags/${{ github.event.release.tag_name }} - filterArguments: '--subdirectory-filter hooks/DDTrace/ --force' - - split-hook-otel: - runs-on: ubuntu-latest - steps: - - name: checkout - run: git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA" - - name: push-hook-otel - uses: tcarrio/git-filter-repo-docker-action@v1 - with: - privateKey: ${{ secrets.SSH_PRIVATE_KEY }} - targetOrg: open-feature-php - targetRepo: otel-hook - targetBranch: refs/tags/${{ github.event.release.tag_name }} - filterArguments: '--subdirectory-filter hooks/OpenTelemetry/ --force' - - split-hook-validator: - runs-on: ubuntu-latest - steps: - - name: checkout - run: git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA" - - name: push-hook-validator - uses: tcarrio/git-filter-repo-docker-action@v1 - with: - privateKey: ${{ secrets.SSH_PRIVATE_KEY }} - targetOrg: open-feature-php - targetRepo: validators-hook - targetBranch: refs/tags/${{ github.event.release.tag_name }} - filterArguments: '--subdirectory-filter hooks/Validators/ --force' - - split-provider-cloudbees: - runs-on: ubuntu-latest - steps: - - name: checkout - run: git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA" - - name: push-provider-cloudbees - uses: tcarrio/git-filter-repo-docker-action@v1 - with: - privateKey: ${{ secrets.SSH_PRIVATE_KEY }} - targetOrg: open-feature-php - targetRepo: cloudbees-provider - targetBranch: refs/tags/${{ github.event.release.tag_name }} - filterArguments: '--subdirectory-filter providers/CloudBees/ --force' - - split-provider-flagd: - runs-on: ubuntu-latest - steps: - - name: checkout - run: git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA" - - name: push-provider-flagd - uses: tcarrio/git-filter-repo-docker-action@v1 - with: - privateKey: ${{ secrets.SSH_PRIVATE_KEY }} - targetOrg: open-feature-php - targetRepo: flagd-provider - targetBranch: refs/tags/${{ github.event.release.tag_name }} - filterArguments: '--subdirectory-filter providers/Flagd/ --force' - - split-provider-split: - runs-on: ubuntu-latest - steps: - - name: checkout - run: git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA" - - name: push-provider-split - uses: tcarrio/git-filter-repo-docker-action@v1 - with: - privateKey: ${{ secrets.SSH_PRIVATE_KEY }} - targetOrg: open-feature-php - targetRepo: split-provider - targetBranch: refs/tags/${{ github.event.release.tag_name }} - filterArguments: '--subdirectory-filter providers/Split/ --force' - - split-provider-go-feature-flag: - runs-on: ubuntu-latest - steps: - - name: checkout - run: git clone "$GITHUB_SERVER_URL"/"$GITHUB_REPOSITORY" "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE" && git checkout "$GITHUB_SHA" - - name: push-provider-split - uses: tcarrio/git-filter-repo-docker-action@v1 - with: - privateKey: ${{ secrets.SSH_PRIVATE_KEY }} - targetOrg: open-feature-php - targetRepo: go-feature-flag-provider - targetBranch: refs/tags/${{ github.event.release.tag_name }} - filterArguments: '--subdirectory-filter providers/GoFeatureFlag/ --force' + targetRepo: ${{ matrix.config[1] }}-${{ matrix.config[0] }} + targetBranch: ${{ steps.targetRef.outputs.result }} + tagFilter: ^open-feature/${{ matrix.config[1] }}- + filterArguments: | + --subdirectory-filter "${{matrix.config[0] }}s/${{ matrix.config[2] }}/" \ + --tag-rename "open-feature/${{ matrix.config[1] }}-${{ matrix.config[0] }}-:" \ + --force diff --git a/.gitsplit.yml b/.gitsplit.yml deleted file mode 100644 index ee802707..00000000 --- a/.gitsplit.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Path to a cache directory Used to speed up the split over time by reusing git's objects -cache_url: "/cache/gitsplit" - -# Path to the repository to split (default = current path) -project_url: "https://github.com/open-feature/php-sdk-contrib.git" - -# List of splits. -splits: - - prefix: "hooks/OpenTelemetry" - target: "https://${GH_TOKEN}@github.com/open-feature-php/otel-hook.git" - - prefix: "hooks/DDTrace" - target: "https://${GH_TOKEN}@github.com/open-feature-php/dd-trace-hook.git" - - prefix: "hooks/Validators" - target: "https://${GH_TOKEN}@github.com/open-feature-php/validators-hook.git" - - prefix: "providers/Flagd" - target: "https://${GH_TOKEN}@github.com/open-feature-php/flagd-provider.git" - - prefix: "providers/Split" - target: "https://${GH_TOKEN}@github.com/open-feature-php/split-provider.git" - - prefix: "providers/CloudBees" - target: "https://${GH_TOKEN}@github.com/open-feature-php/cloudbees-provider.git" - -# List of references to split (defined as regexp) -origins: - - ^main$ - - ^test$ - - ^split$ - - ^v\d+\.\d+\.\d+$ - - ^\d+\.\d+\.\d+$ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c28141e7..39bcb904 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,9 +1,9 @@ { - "hooks/DDTrace": "0.2.0", - "hooks/OpenTelemetry": "0.2.0", - "hooks/Validators": "0.2.0", - "providers/CloudBees": "0.3.0", - "providers/Flagd": "0.4.0", - "providers/Split": "0.3.0", - "providers/GoFeatureFlag": "0.1.0" + "hooks/DDTrace": "1.0.0", + "hooks/OpenTelemetry": "1.0.0", + "hooks/Validators": "1.0.0", + "providers/CloudBees": "1.0.0", + "providers/Flagd": "1.0.0", + "providers/Split": "1.0.0", + "providers/GoFeatureFlag": "1.0.0" } \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json index 84279a5e..e84fa621 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -8,31 +8,31 @@ "packages": { "hooks/DDTrace": { "package-name": "open-feature/dd-trace-hook", - "release-as": "0.2.0" + "release-as": "1.0.0" }, "hooks/OpenTelemetry": { "package-name": "open-feature/otel-hook", - "release-as": "0.2.0" + "release-as": "1.0.0" }, "hooks/Validators": { "package-name": "open-feature/validators-hook", - "release-as": "0.2.0" + "release-as": "1.0.0" }, "providers/CloudBees": { "package-name": "open-feature/cloudbees-provider", - "release-as": "0.3.0" + "release-as": "1.0.0" }, "providers/Flagd": { "package-name": "open-feature/flagd-provider", - "release-as": "0.4.0" + "release-as": "1.0.0" }, "providers/Split": { "package-name": "open-feature/split-provider", - "release-as": "0.3.0" + "release-as": "1.0.0" }, "providers/GoFeatureFlag": { "package-name": "open-feature/go-feature-flag-provider", - "release-as": "0.1.0" + "release-as": "1.0.0" } } }