Skip to content

Commit

Permalink
Merge pull request #2183 from dpfaffenbauer/infra/gitsplit2
Browse files Browse the repository at this point in the history
infra: do gitsplit on merge or release
  • Loading branch information
dpfaffenbauer authored Jan 24, 2023
2 parents b0d6eef + 9d2efb8 commit aa7e7cb
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/gitsplit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Monorepo split
on:
push:
branches:
- "master"
- "2.0"
- "2.1"
- "2.2"
- "3.0"
release:
types: [ published ]

jobs:
gitsplit:
runs-on: ubuntu-latest
steps:
-
name: Full checkout
run: git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY /home/runner/work/CoreShop/CoreShop && cd /home/runner/work/CoreShop/CoreShop && git checkout $GITHUB_SHA
-
name: Split repositories
uses: docker://jderusse/gitsplit:latest
with:
args: gitsplit
env:
GH_TOKEN: ${{ secrets.GITSPLIT_TOKEN }}
70 changes: 70 additions & 0 deletions .gitsplit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
origins:
- ^master$
- '^\d+\.\d+$ #CoreShop Maintenance Branches'
- '^\d+\.\d+\.\d+$ #Tags'
splits:
- { prefix: src/CoreShop/Component/Address, target: 'https://${GH_TOKEN}@github.com/coreshop/Address.git' }
- { prefix: src/CoreShop/Bundle/AddressBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/AddressBundle.git' }
- { prefix: src/CoreShop/Component/Configuration, target: 'https://${GH_TOKEN}@github.com/coreshop/Configuration.git' }
- { prefix: src/CoreShop/Bundle/ConfigurationBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/ConfigurationBundle.git' }
- { prefix: src/CoreShop/Component/Core, target: 'https://${GH_TOKEN}@github.com/coreshop/Core.git' }
- { prefix: src/CoreShop/Bundle/CoreBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/CoreBundle.git' }
- { prefix: src/CoreShop/Component/Currency, target: 'https://${GH_TOKEN}@github.com/coreshop/Currency.git' }
- { prefix: src/CoreShop/Bundle/CurrencyBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/CurrencyBundle.git' }
- { prefix: src/CoreShop/Component/Customer, target: 'https://${GH_TOKEN}@github.com/coreshop/Customer.git' }
- { prefix: src/CoreShop/Bundle/CustomerBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/CustomerBundle.git' }
- { prefix: src/CoreShop/Bundle/FixtureBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/FixtureBundle.git' }
- { prefix: src/CoreShop/Bundle/FrontendBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/FrontendBundle.git' }
- { prefix: src/CoreShop/Component/Index, target: 'https://${GH_TOKEN}@github.com/coreshop/Index.git' }
- { prefix: src/CoreShop/Bundle/IndexBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/IndexBundle.git' }
- { prefix: src/CoreShop/Component/Inventory, target: 'https://${GH_TOKEN}@github.com/coreshop/Inventory.git' }
- { prefix: src/CoreShop/Bundle/InventoryBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/InventoryBundle.git' }
- { prefix: src/CoreShop/Component/Locale, target: 'https://${GH_TOKEN}@github.com/coreshop/Locale.git' }
- { prefix: src/CoreShop/Bundle/LocaleBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/LocaleBundle.git' }
- { prefix: src/CoreShop/Bundle/MenuBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/MenuBundle.git' }
- { prefix: src/CoreShop/Bundle/MessengerBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/MessengerBundle.git' }
- { prefix: src/CoreShop/Bundle/MoneyBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/MoneyBundle.git' }
- { prefix: src/CoreShop/Component/Notification, target: 'https://${GH_TOKEN}@github.com/coreshop/Notification.git' }
- { prefix: src/CoreShop/Bundle/NotificationBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/NotificationBundle.git' }
- { prefix: src/CoreShop/Bundle/OptimisticEntityLockBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/OptimisticEntityLockBundle.git' }
- { prefix: src/CoreShop/Component/Order, target: 'https://${GH_TOKEN}@github.com/coreshop/Order.git' }
- { prefix: src/CoreShop/Bundle/OrderBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/OrderBundle.git' }
- { prefix: src/CoreShop/Component/Payment, target: 'https://${GH_TOKEN}@github.com/coreshop/Payment.git' }
- { prefix: src/CoreShop/Bundle/PaymentBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/PaymentBundle.git' }
- { prefix: src/CoreShop/Bundle/PayumBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/PayumBundle.git' }
- { prefix: src/CoreShop/Component/PayumPayment, target: 'https://${GH_TOKEN}@github.com/coreshop/PayumPayment.git' }
- { prefix: src/CoreShop/Bundle/PayumPaymentBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/PayumPaymentBundle.git' }
- { prefix: src/CoreShop/Component/Pimcore, target: 'https://${GH_TOKEN}@github.com/coreshop/Pimcore.git' }
- { prefix: src/CoreShop/Bundle/PimcoreBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/PimcoreBundle.git' }
- { prefix: src/CoreShop/Component/Product, target: 'https://${GH_TOKEN}@github.com/coreshop/Product.git' }
- { prefix: src/CoreShop/Bundle/ProductBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/ProductBundle.git' }
- { prefix: src/CoreShop/Component/ProductQuantityPriceRules, target: 'https://${GH_TOKEN}@github.com/coreshop/ProductQuantityPriceRules.git' }
- { prefix: src/CoreShop/Bundle/ProductQuantityPriceRulesBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/ProductQuantityPriceRulesBundle.git' }
- { prefix: src/CoreShop/Component/Registry, target: 'https://${GH_TOKEN}@github.com/coreshop/Registry.git' }
- { prefix: src/CoreShop/Component/Resource, target: 'https://${GH_TOKEN}@github.com/coreshop/Resource.git' }
- { prefix: src/CoreShop/Bundle/ResourceBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/ResourceBundle.git' }
- { prefix: src/CoreShop/Component/Rule, target: 'https://${GH_TOKEN}@github.com/coreshop/Rule.git' }
- { prefix: src/CoreShop/Bundle/RuleBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/RuleBundle.git' }
- { prefix: src/CoreShop/Component/SEO, target: 'https://${GH_TOKEN}@github.com/coreshop/SEO.git' }
- { prefix: src/CoreShop/Bundle/SEOBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/SEOBundle.git' }
- { prefix: src/CoreShop/Component/Sequence, target: 'https://${GH_TOKEN}@github.com/coreshop/Sequence.git' }
- { prefix: src/CoreShop/Bundle/SequenceBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/SequenceBundle.git' }
- { prefix: src/CoreShop/Component/Shipping, target: 'https://${GH_TOKEN}@github.com/coreshop/Shipping.git' }
- { prefix: src/CoreShop/Bundle/ShippingBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/ShippingBundle.git' }
- { prefix: src/CoreShop/Component/StorageList, target: 'https://${GH_TOKEN}@github.com/coreshop/StorageList.git' }
- { prefix: src/CoreShop/Bundle/StorageListBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/StorageListBundle.git' }
- { prefix: src/CoreShop/Component/Store, target: 'https://${GH_TOKEN}@github.com/coreshop/Store.git' }
- { prefix: src/CoreShop/Bundle/StoreBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/StoreBundle.git' }
- { prefix: src/CoreShop/Component/Taxation, target: 'https://${GH_TOKEN}@github.com/coreshop/Taxation.git' }
- { prefix: src/CoreShop/Bundle/TaxationBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/TaxationBundle.git' }
- { prefix: src/CoreShop/Bundle/TestBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/TestBundle.git' }
- { prefix: src/CoreShop/Bundle/ThemeBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/ThemeBundle.git' }
- { prefix: src/CoreShop/Component/Tracking, target: 'https://${GH_TOKEN}@github.com/coreshop/Tracking.git' }
- { prefix: src/CoreShop/Bundle/TrackingBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/TrackingBundle.git' }
- { prefix: src/CoreShop/Component/User, target: 'https://${GH_TOKEN}@github.com/coreshop/User.git' }
- { prefix: src/CoreShop/Bundle/UserBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/UserBundle.git' }
- { prefix: src/CoreShop/Component/Variant, target: 'https://${GH_TOKEN}@github.com/coreshop/Variant.git' }
- { prefix: src/CoreShop/Bundle/VariantBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/VariantBundle.git' }
- { prefix: src/CoreShop/Component/Wishlist, target: 'https://${GH_TOKEN}@github.com/coreshop/Wishlist.git' }
- { prefix: src/CoreShop/Bundle/WishlistBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/WishlistBundle.git' }
- { prefix: src/CoreShop/Bundle/WorkflowBundle, target: 'https://${GH_TOKEN}@github.com/coreshop/WorkflowBundle.git' }
43 changes: 43 additions & 0 deletions bin/generate-gitsplit
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php

use Symfony\Component\Finder\Finder;

$root = realpath(__DIR__.'/..');

require_once $root.'/vendor/autoload.php';

$find = static function (string $path) use ($root): array
{
$dirs = new Finder();
$dirs
->in($path)
->depth(0)
->directories();

$splits = [];
foreach ($dirs as $dir) {
$splits[] = [
'prefix' => str_replace($root .'/', '', $dir->getRealPath()),
'target' => sprintf('https://${GH_TOKEN}@github.com/coreshop/%1$s.git', $dir->getFileName()),
];
}

return $splits;
};

$config = [
'origins' => [
'^master$',
'^\d+\.\d+$ #CoreShop Maintenance Branches',
'^\d+\.\d+\.\d+$ #Tags',
],
'splits' => [],
];

$config['splits'] = array_merge($config['splits'], $find($root.'/src/CoreShop/Bundle'));
$config['splits'] = array_merge($config['splits'], $find($root.'/src/CoreShop/Component'));

usort($config['splits'], static fn(array $a, array $b): int => basename($a['prefix']) <=> basename($b['prefix']));

file_put_contents($root.'/.gitsplit.yml', Symfony\Component\Yaml\Yaml::dump($config));

0 comments on commit aa7e7cb

Please sign in to comment.