Skip to content

Repo Setup Checklist — middag-io

Step-by-step guide for creating and configuring a new repository. References: ADR-001, ADR-002, ADR-006.

1. Create Repository

bash
gh repo create middag-io/{name} --private --description "{description}"

Naming: follow ADR-001.

TypePatternExample
WP pluginwp-plugin-{name}wp-plugin-my-project
WP themewp-theme-{name}wp-theme-my-project
Dockerdocker-{stack}-{name}docker-wp-my-project
Moodle pluginmoodle-{frankenstyle}moodle-local_middag
PHP librarymiddag-php-{name}middag-php-framework
JS/TS librarymiddag-{name}middag-react
Infrastructureinfra-{name}my-satis-repo

2. Configure Branches

bash
# Set default branch
gh repo edit middag-io/{name} --default-branch main

# Create develop branch
git checkout -b develop
git push -u origin develop

Org rulesets auto-apply:

  • main: require PR, 1 approval, status checks, no force push, no delete
  • develop: require PR, status checks, no force push

3. Add Topics and Custom Properties

bash
# Topics (comma-separated)
gh repo edit middag-io/{name} --add-topic wordpress,plugin,middag

# Custom properties (via API)
gh api repos/middag-io/{name}/properties/values \
  -X PATCH \
  -f properties[][property_name]=platform -f properties[][value]=wordpress \
  -f properties[][property_name]=component-type -f properties[][value]=plugin \
  -f properties[][property_name]=deploy-target -f properties[][value]=production

4. Add CI Workflow

Create .github/workflows/ci.yml using the appropriate reusable workflow:

WordPress Plugin

yaml
name: CI
on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main, develop]

jobs:
  ci:
    uses: middag-io/.github-private/.github/workflows/wp-plugin-ci.yml@workflows-v1
    with:
      has-tests: true      # if composer test exists
      has-ui: true          # if ui/ directory exists
      has-rector: true      # if rector is configured
    secrets: inherit

WordPress Theme

yaml
name: CI
on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main, develop]

jobs:
  ci:
    uses: middag-io/.github-private/.github/workflows/wp-theme-ci.yml@workflows-v1
    with:
      has-rector: true
    secrets: inherit

5. Configure release-please

5.1 Create config files

release-please-config.json:

json
{
  "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
  "packages": {
    ".": {
      "release-type": "simple",
      "include-v-in-tag": false,
      "extra-files": [
        {
          "type": "generic",
          "path": "{main-file}.php"
        }
      ]
    }
  }
}

.release-please-manifest.json:

json
{
  ".": "1.0.0"
}

5.2 Add version annotations

In the main plugin/theme file, add // x-release-please-version after version lines:

php
 * Version: 1.0.0 // x-release-please-version
define('MY_PLUGIN_VERSION', '1.0.0'); // x-release-please-version

For themes (style.css): Version: 1.0.0 x-release-please-version

5.3 Add release workflow

yaml
name: Release
on:
  push:
    branches: [main]

jobs:
  release-please:
    uses: middag-io/.github-private/.github/workflows/release-please.yml@workflows-v1
    permissions:
      contents: write
      pull-requests: write
    secrets: inherit

  post-release:
    needs: release-please
    if: needs.release-please.outputs.release_created == 'true'
    uses: middag-io/.github-private/.github/workflows/wp-plugin-post-release.yml@workflows-v1
    with:
      tag-name: ${{ needs.release-please.outputs.tag_name }}
      zip-name: {plugin-folder-name}
      # has-ui: true        # uncomment if plugin has ui/
      # has-strauss: true    # uncomment if plugin uses strauss
    permissions:
      contents: write
    secrets: inherit

6. Configure Secrets (if needed)

See G03 — 1Password Operations for full procedure.

Quick summary:

  1. Create vault CI-{PROJECT} in 1Password
  2. Create SA sa-github-ci-{project}, grant vault access
  3. gh secret set OP_SA_{PROJECT} --repo middag-io/{name}

7. Test

bash
# Push to develop — CI should trigger
git push origin develop

# Open PR to main — CI should run on PR
gh pr create --title "Initial setup" --body "CI + release-please"

# Verify CI passes
gh run list --repo middag-io/{name}

8. Final Checklist

  • [ ] Repo created with correct name prefix
  • [ ] Default branch set to main
  • [ ] develop branch created
  • [ ] Topics added (platform, type, client)
  • [ ] Custom properties set
  • [ ] CI workflow calling reusable workflow
  • [ ] release-please config + manifest
  • [ ] Version annotations in main file
  • [ ] Release workflow
  • [ ] 1Password secrets configured (if applicable)
  • [ ] CI green on develop
  • [ ] CI green on PR to main

MIDDAG Tecnologia