From e872dfb8921cc084f5147312ed2a92acf1e7d63b Mon Sep 17 00:00:00 2001 From: camilleislasse Date: Fri, 19 Jun 2026 21:03:27 +0200 Subject: [PATCH] chore: remove unused bootstrap pipeline Plugins are set up manually from the Sylius skeleton, not via bootstrap. Packagist stays in sync through its native GitHub webhook, so submit-packagist and create-flex-recipe never ran. Keep only the live reusable workflows: release-please and claude-review. Claude-Session: https://claude.ai/code/session_01UjSKLDquR9hJa3Dg6dJKxi --- .github/workflows/bootstrap.yml | 192 ------------------ .github/workflows/create-flex-recipe.yml | 98 --------- .github/workflows/submit-packagist.yml | 50 ----- templates/.claude/rules/code-quality.md | 5 - templates/.claude/rules/commits.md | 5 - templates/.claude/rules/docker.md | 5 - .../.github/workflows/create-flex-recipe.yml | 11 - templates/.github/workflows/initial-tag.yml | 34 ---- .../.github/workflows/release-please.yml | 11 - templates/.github/workflows/setup-ruleset.yml | 65 ------ .../.github/workflows/submit-packagist.yml | 11 - templates/.release-please-manifest.json | 3 - templates/README.md | 44 ---- templates/release-please-config.json | 8 - 14 files changed, 542 deletions(-) delete mode 100644 .github/workflows/bootstrap.yml delete mode 100644 .github/workflows/create-flex-recipe.yml delete mode 100644 .github/workflows/submit-packagist.yml delete mode 100644 templates/.claude/rules/code-quality.md delete mode 100644 templates/.claude/rules/commits.md delete mode 100644 templates/.claude/rules/docker.md delete mode 100644 templates/.github/workflows/create-flex-recipe.yml delete mode 100644 templates/.github/workflows/initial-tag.yml delete mode 100644 templates/.github/workflows/release-please.yml delete mode 100644 templates/.github/workflows/setup-ruleset.yml delete mode 100644 templates/.github/workflows/submit-packagist.yml delete mode 100644 templates/.release-please-manifest.json delete mode 100644 templates/README.md delete mode 100644 templates/release-please-config.json diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml deleted file mode 100644 index 99cd1f8..0000000 --- a/.github/workflows/bootstrap.yml +++ /dev/null @@ -1,192 +0,0 @@ -name: Bootstrap Plugin - -on: - workflow_dispatch: - inputs: - repo: - description: 'Target repo name (e.g. GuiziwebTestPlugin)' - required: true - company: - description: 'Company name (PascalCase, e.g. Guiziweb)' - required: true - name: - description: 'Plugin name (PascalCase, e.g. Test)' - required: true - description: - description: 'Plugin description' - required: true - org: - description: 'GitHub org' - required: false - default: 'Guiziweb' - -jobs: - bootstrap: - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@v4 - - - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: ${{ inputs.org }} - - - - name: Create or check repo - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - if gh api repos/${{ inputs.org }}/${{ inputs.repo }} --silent 2>/dev/null; then - COUNT=$(gh api repos/${{ inputs.org }}/${{ inputs.repo }}/commits 2>/dev/null | jq 'if type == "array" then length else 0 end') - if [ "$COUNT" -gt "0" ]; then - echo "::error::Repo already has commits. Bootstrap aborted." - exit 1 - fi - echo "Repo exists and is empty, continuing." - else - gh api orgs/${{ inputs.org }}/repos \ - --method POST \ - --field name="${{ inputs.repo }}" \ - --field private=false \ - --field description="${{ inputs.description }}" \ - --jq '.full_name' - echo "Repo created." - fi - - - - name: Derive names - id: meta - env: - COMPANY: ${{ inputs.company }} - NAME: ${{ inputs.name }} - run: | - python3 - >> $GITHUB_OUTPUT <<'EOF' - import re, os - - company = os.environ['COMPANY'] - name = os.environ['NAME'] - company_kebab = re.sub(r'([a-z])([A-Z])', r'\1-\2', company).lower() - name_kebab = re.sub(r'([a-z])([A-Z])', r'\1-\2', name).lower() - - print(f'company_kebab={company_kebab}') - print(f'name_kebab={name_kebab}') - EOF - - - - name: Clone skeleton - run: | - git clone https://github.com/Sylius/PluginSkeleton.git /tmp/plugin - - - - name: Rename plugin - working-directory: /tmp/plugin - run: | - composer install --no-interaction --quiet - php bin/rename-plugin.php \ - --company="${{ inputs.company }}" \ - --plugin-name="${{ inputs.name }}" \ - --description="${{ inputs.description }}" \ - --skip-interaction - - - - name: Cleanup skeleton - working-directory: /tmp/plugin - run: | - python3 - <<'EOF' - import os, re, shutil - - files_to_remove = [ - 'RENAME_GUIDE.md', 'CLAUDE.md', 'AGENTS.md', - 'CLEANUP_GUIDE.md', 'COMPATIBILITY_GUIDE.md', - 'src/Controller/GreetingController.php', - 'assets/shop/js/greetings.js', - 'features/dynamically_greeting_a_customer.feature', - 'features/statically_greeting_a_customer.feature', - 'config/services.xml', - ] - dirs_to_remove = ['templates/shop/greeting'] - - for f in files_to_remove: - if os.path.exists(f): - os.remove(f) - for d in dirs_to_remove: - if os.path.exists(d): - shutil.rmtree(d) - - ext_dir = 'src/DependencyInjection' - for fname in os.listdir(ext_dir): - if fname.endswith('Extension.php'): - path = os.path.join(ext_dir, fname) - lines = open(path).readlines() - lines = [l for l in lines if not re.search(r'XmlFileLoader|FileLocator|services\.xml', l)] - open(path, 'w').writelines(lines) - - for f in ['config/twig_hooks/shop.yaml', 'config/routes/shop.yaml', - 'config/routes/admin.yaml', 'assets/shop/entrypoint.js']: - if os.path.exists(f): - open(f, 'w').close() - - print("Skeleton cleaned up") - EOF - - - - name: Apply templates - working-directory: /tmp/plugin - env: - COMPANY: ${{ inputs.company }} - NAME: ${{ inputs.name }} - DESCRIPTION: ${{ inputs.description }} - COMPANY_KEBAB: ${{ steps.meta.outputs.company_kebab }} - NAME_KEBAB: ${{ steps.meta.outputs.name_kebab }} - run: | - cp -r $GITHUB_WORKSPACE/templates/. . - - python3 - <<'EOF' - import os - company = os.environ['COMPANY'] - name = os.environ['NAME'] - bundle_class = f"{company}Sylius{name}Plugin" - package = f"{os.environ['COMPANY_KEBAB']}/sylius-{os.environ['NAME_KEBAB']}-plugin" - description = os.environ['DESCRIPTION'] - content = open('README.md').read() - content = content.replace('{BundleClass}', bundle_class) - content = content.replace('{description}', description) - content = content.replace('{package}', package) - open('README.md', 'w').write(content) - EOF - - - - name: Push to target repo - working-directory: /tmp/plugin - run: | - rm -rf .git - git init -b main - git config user.name "guiziweb-bot[bot]" - git config user.email "guiziweb-bot[bot]@users.noreply.github.com" - git remote add origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ inputs.org }}/${{ inputs.repo }}.git - git add -A - git commit -m "chore: bootstrap plugin from skeleton" - git push --force origin main - - - - name: Create summary issue - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - PACKAGE="${{ steps.meta.outputs.company_kebab }}/sylius-${{ steps.meta.outputs.name_kebab }}-plugin" - - gh issue create \ - --repo ${{ inputs.org }}/${{ inputs.repo }} \ - --title "Plugin bootstrapped" \ - --body "## ${{ inputs.repo }} - - | | | - |---|---| - | **Package** | \`${PACKAGE}\` | - | **Packagist** | https://packagist.org/packages/${PACKAGE} | - - > La PR Flex Recipe sera ajoutée en commentaire une fois créée." \ No newline at end of file diff --git a/.github/workflows/create-flex-recipe.yml b/.github/workflows/create-flex-recipe.yml deleted file mode 100644 index 6607d40..0000000 --- a/.github/workflows/create-flex-recipe.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Create Flex Recipe - -on: - workflow_call: - -jobs: - create-recipe: - runs-on: ubuntu-latest - steps: - - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - - - - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - - - - name: Extract plugin metadata - id: meta - run: | - python3 - >> $GITHUB_OUTPUT <<'EOF' - import json, re - - data = json.load(open('composer.json')) - package = data['name'] - company, pkg = package.split('/') - ns = list(data['autoload']['psr-4'].keys())[0].rstrip('\\') - bundle_class = ns.replace('\\', '') - name_part = re.sub(r'-plugin$', '', re.sub(r'^sylius-', '', pkg)).replace('-', '_') - alias = company.replace('-', '_') + '_' + name_part - - print(f'company_kebab={company}') - print(f'package_kebab={pkg}') - print(f'ns={ns}') - print(f'bundle_class={bundle_class}') - print(f'alias={alias}') - EOF - - - - name: Clone SyliusRecipes - run: | - git clone \ - "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/Guiziweb/SyliusRecipes.git" \ - /tmp/SyliusRecipes - - - - name: Create recipe files - run: | - RECIPE_DIR="/tmp/SyliusRecipes/${{ steps.meta.outputs.company_kebab }}/${{ steps.meta.outputs.package_kebab }}/0.1" - mkdir -p "${RECIPE_DIR}/config/packages" - mkdir -p "${RECIPE_DIR}/config/routes" - - jq -n \ - --arg fqcn "${{ steps.meta.outputs.ns }}\\${{ steps.meta.outputs.bundle_class }}" \ - '{"bundles": {($fqcn): ["all"]}, "copy-from-recipe": {"config/": "%CONFIG_DIR%/"}}' \ - > "${RECIPE_DIR}/manifest.json" - - printf 'imports:\n - { resource: "@%s/config/config.yaml" }\n' \ - "${{ steps.meta.outputs.bundle_class }}" \ - > "${RECIPE_DIR}/config/packages/${{ steps.meta.outputs.package_kebab }}.yaml" - - printf '%s_admin:\n resource: "@%s/config/routes/admin.yaml"\n\n%s_shop:\n resource: "@%s/config/routes/shop.yaml"\n' \ - "${{ steps.meta.outputs.alias }}" "${{ steps.meta.outputs.bundle_class }}" \ - "${{ steps.meta.outputs.alias }}" "${{ steps.meta.outputs.bundle_class }}" \ - > "${RECIPE_DIR}/config/routes/${{ steps.meta.outputs.package_kebab }}.yaml" - - echo "${{ steps.meta.outputs.bundle_class }} installed!" \ - > "${RECIPE_DIR}/post-install.txt" - - - - name: Open PR on SyliusRecipes - run: | - cd /tmp/SyliusRecipes - git config user.name "guiziweb-bot[bot]" - git config user.email "guiziweb-bot[bot]@users.noreply.github.com" - BRANCH="feat/${{ steps.meta.outputs.package_kebab }}" - git checkout -b "$BRANCH" - git add -A - git commit -m "feat: add recipe for ${{ steps.meta.outputs.package_kebab }} 0.1" - git push origin "$BRANCH" --force - export GH_TOKEN="${{ steps.app-token.outputs.token }}" - PR_URL=$(gh pr view "$BRANCH" --repo Guiziweb/SyliusRecipes --json url --jq '.url' 2>/dev/null \ - || gh pr create \ - --repo Guiziweb/SyliusRecipes \ - --title "feat: add recipe for ${{ steps.meta.outputs.package_kebab }} 0.1" \ - --body "Automated recipe for \`${{ steps.meta.outputs.company_kebab }}/${{ steps.meta.outputs.package_kebab }}\`." \ - --base main \ - --head "$BRANCH") - - gh issue comment 1 \ - --repo ${{ github.repository }} \ - --body "**Flex Recipe PR créée :** ${PR_URL}" \ No newline at end of file diff --git a/.github/workflows/submit-packagist.yml b/.github/workflows/submit-packagist.yml deleted file mode 100644 index ed62554..0000000 --- a/.github/workflows/submit-packagist.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Submit to Packagist - -on: - workflow_call: - -jobs: - submit: - runs-on: ubuntu-latest - steps: - - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - - - - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - - - - name: Check if package already exists - id: check - run: | - PACKAGE=$(python3 -c "import json; print(json.load(open('composer.json'))['name'])") - STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://repo.packagist.org/p2/${PACKAGE}.json") - if [ "$STATUS" = "200" ]; then - echo "Package ${PACKAGE} already exists on Packagist, skipping." - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "exists=false" >> $GITHUB_OUTPUT - fi - - - - name: Submit package to Packagist - if: steps.check.outputs.exists == 'false' - run: | - RESPONSE=$(curl -s -X POST \ - -H 'Content-Type: application/json' \ - -H "Authorization: Bearer ${{ secrets.PACKAGIST_USERNAME }}:${{ secrets.PACKAGIST_TOKEN }}" \ - 'https://packagist.org/api/create-package' \ - -d "{\"repository\": \"https://github.com/${{ github.repository }}\"}") - echo "$RESPONSE" - if echo "$RESPONSE" | grep -q '"status":"success"'; then - echo "Package successfully submitted to Packagist!" - else - echo "Submission failed." - exit 1 - fi \ No newline at end of file diff --git a/templates/.claude/rules/code-quality.md b/templates/.claude/rules/code-quality.md deleted file mode 100644 index 9217de0..0000000 --- a/templates/.claude/rules/code-quality.md +++ /dev/null @@ -1,5 +0,0 @@ -# Qualité de code - -- Toujours `declare(strict_types=1)` en tête de chaque fichier PHP. -- Toujours lancer `make phpstan` et `make ecs` avant de commiter. -- Ne jamais ignorer une erreur PHPStan sans commentaire justifié. \ No newline at end of file diff --git a/templates/.claude/rules/commits.md b/templates/.claude/rules/commits.md deleted file mode 100644 index b01f5aa..0000000 --- a/templates/.claude/rules/commits.md +++ /dev/null @@ -1,5 +0,0 @@ -# Commits - -- Suivre [Conventional Commits](https://www.conventionalcommits.org/) : `(): ` -- Types : `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `style` -- Le scope est optionnel, il précise la partie du plugin concernée. \ No newline at end of file diff --git a/templates/.claude/rules/docker.md b/templates/.claude/rules/docker.md deleted file mode 100644 index e09d413..0000000 --- a/templates/.claude/rules/docker.md +++ /dev/null @@ -1,5 +0,0 @@ -# Docker - -- Toujours passer par `make` pour exécuter des commandes PHP, Composer ou Symfony Console. -- Ne jamais exécuter ces commandes directement sur la machine hôte. -- Toujours préciser `ENV=dev` en local. \ No newline at end of file diff --git a/templates/.github/workflows/create-flex-recipe.yml b/templates/.github/workflows/create-flex-recipe.yml deleted file mode 100644 index ec7ae3c..0000000 --- a/templates/.github/workflows/create-flex-recipe.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Create Flex Recipe - -on: - push: - tags: - - 'v0.1.0' - -jobs: - create-recipe: - uses: Guiziweb/.github/.github/workflows/create-flex-recipe.yml@main - secrets: inherit \ No newline at end of file diff --git a/templates/.github/workflows/initial-tag.yml b/templates/.github/workflows/initial-tag.yml deleted file mode 100644 index 961e217..0000000 --- a/templates/.github/workflows/initial-tag.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Initial Tag - -on: - push: - branches: [main] - -jobs: - tag: - runs-on: ubuntu-latest - steps: - - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - - - - uses: actions/checkout@v4 - with: - token: ${{ steps.app-token.outputs.token }} - fetch-tags: true - - - - name: Create v0.1.0 tag if not exists - run: | - if git tag | grep -q '^v0.1.0$'; then - echo "Tag v0.1.0 already exists, skipping." - exit 0 - fi - git tag v0.1.0 - git push origin v0.1.0 - echo "Tag v0.1.0 created." \ No newline at end of file diff --git a/templates/.github/workflows/release-please.yml b/templates/.github/workflows/release-please.yml deleted file mode 100644 index 30c4a0f..0000000 --- a/templates/.github/workflows/release-please.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Release Please - -on: - push: - branches: - - main - -jobs: - release-please: - uses: Guiziweb/.github/.github/workflows/release-please.yml@main - secrets: inherit \ No newline at end of file diff --git a/templates/.github/workflows/setup-ruleset.yml b/templates/.github/workflows/setup-ruleset.yml deleted file mode 100644 index 0069249..0000000 --- a/templates/.github/workflows/setup-ruleset.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Setup Branch Protection - -on: - workflow_run: - workflows: ["Build"] - types: [completed] - branches: [main] - -jobs: - setup-protection: - runs-on: ubuntu-latest - if: ${{ !github.event.workflow_run.conclusion || github.event.workflow_run.conclusion == 'success' }} - steps: - - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - - - - name: Setup branch protection - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - # Skip if branch protection already configured - STATUS=$(gh api repos/${{ github.repository }}/branches/main/protection \ - --jq '.required_pull_request_reviews != null or .required_status_checks != null' \ - 2>/dev/null || echo "false") - if [ "$STATUS" = "true" ]; then - echo "Branch protection already configured, skipping." - exit 0 - fi - - python3 - <<'EOF' - import json, os, subprocess - - repo = os.environ['GITHUB_REPOSITORY'] - - payload = { - "required_status_checks": { - "strict": False, - "contexts": ["build"] - }, - "enforce_admins": False, - "required_pull_request_reviews": { - "required_approving_review_count": 0, - "dismiss_stale_reviews": False, - "require_code_owner_reviews": False - }, - "restrictions": None - } - - result = subprocess.run( - ["gh", "api", f"repos/{repo}/branches/main/protection", - "--method", "PUT", "--input", "-"], - input=json.dumps(payload).encode(), - capture_output=True - ) - print(result.stdout.decode()) - if result.returncode != 0: - print(result.stderr.decode(), flush=True) - exit(result.returncode) - EOF \ No newline at end of file diff --git a/templates/.github/workflows/submit-packagist.yml b/templates/.github/workflows/submit-packagist.yml deleted file mode 100644 index 19cca39..0000000 --- a/templates/.github/workflows/submit-packagist.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Submit to Packagist - -on: - push: - tags: - - 'v0.1.0' - -jobs: - submit: - uses: Guiziweb/.github/.github/workflows/submit-packagist.yml@main - secrets: inherit \ No newline at end of file diff --git a/templates/.release-please-manifest.json b/templates/.release-please-manifest.json deleted file mode 100644 index 88d1d60..0000000 --- a/templates/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "0.1.0" -} \ No newline at end of file diff --git a/templates/README.md b/templates/README.md deleted file mode 100644 index 69c250d..0000000 --- a/templates/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# {BundleClass} - -{description} - -## Requirements - -- PHP ^8.2 -- Sylius ^2.0 - -## Installation - -Add the Flex endpoint to your `composer.json`: - -```json -{ - "extra": { - "symfony": { - "endpoint": [ - "https://api.github.com/repos/Guiziweb/SyliusRecipes/contents/index.json?ref=flex/main", - "flex://defaults" - ] - } - } -} -``` - -Then: - -```bash -composer require {package} -``` - -## Development - -```bash -cp compose.override.dist.yml compose.override.yml -ENV=dev make init -ENV=dev make database-init -ENV=dev make load-fixtures -``` - -## License - -MIT diff --git a/templates/release-please-config.json b/templates/release-please-config.json deleted file mode 100644 index 4bbc16f..0000000 --- a/templates/release-please-config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "packages": { - ".": { - "release-type": "simple", - "bump-minor-pre-major": true - } - } -} \ No newline at end of file