Skip to content

Checklist de Setup de Repositório — middag-io

Guia passo-a-passo para criar e configurar um novo repositório. Referências: ADR-001, ADR-002, ADR-006.

1. Criar Repositório

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

Nomenclatura: siga ADR-001.

TipoPadrãoExemplo
Plugin WPwp-plugin-{name}wp-plugin-my-project
Tema WPwp-theme-{name}wp-theme-my-project
Dockerdocker-{stack}-{name}docker-wp-my-project
Plugin Moodlemoodle-{frankenstyle}moodle-local_middag
Biblioteca PHPmiddag-php-{name}middag-php-framework
Biblioteca JS/TSmiddag-{name}middag-react
Infraestruturainfra-{name}my-satis-repo

2. Configurar Branches

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

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

Rulesets da org são aplicados automaticamente:

  • main: requer PR, 1 aprovação, status checks, sem force push, sem delete
  • develop: requer PR, status checks, sem force push

3. Adicionar Topics e Custom Properties

bash
# Topics (separados por vírgula)
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. Adicionar Workflow CI

Criar .github/workflows/ci.yml usando o workflow reutilizável apropriado:

Plugin WordPress

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      # se composer test existe
      has-ui: true          # se diretório ui/ existe
      has-rector: true      # se rector está configurado
    secrets: inherit

Tema WordPress

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. Configurar release-please

5.1 Criar arquivos de configuração

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 Adicionar anotações de versão

No arquivo principal de plugin/theme, adicione // x-release-please-version após linhas de versão:

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

Para temas (style.css): Version: 1.0.0 x-release-please-version

5.3 Adicionar workflow de release

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        # descomente se plugin tem ui/
      # has-strauss: true    # descomente se plugin usa strauss
    permissions:
      contents: write
    secrets: inherit

6. Configurar Secrets (se necessário)

Veja G03 — Operações 1Password para o procedimento completo.

Resumo rápido:

  1. Criar vault CI-{PROJECT} no 1Password
  2. Criar SA sa-github-ci-{project}, conceder acesso ao vault
  3. gh secret set OP_SA_{PROJECT} --repo middag-io/{name}

7. Testar

bash
# Push para develop — CI deve disparar
git push origin develop

# Abrir PR para main — CI deve rodar no PR
gh pr create --title "Initial setup" --body "CI + release-please"

# Verificar se CI passa
gh run list --repo middag-io/{name}

8. Checklist Final

  • [ ] Repo criado com prefixo de nome correto
  • [ ] Branch default definido como main
  • [ ] Branch develop criada
  • [ ] Topics adicionados (platform, type, client)
  • [ ] Custom properties definidos
  • [ ] Workflow CI chamando workflow reutilizável
  • [ ] Config + manifest release-please
  • [ ] Anotações de versão no arquivo principal
  • [ ] Workflow de release
  • [ ] Secrets 1Password configurados (se aplicável)
  • [ ] CI verde em develop
  • [ ] CI verde em PR para main

MIDDAG Tecnologia