146 lines
3.9 KiB
Bash
Executable file
146 lines
3.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
cd ~/Alliance-Boreale
|
||
|
||
# 0) identité auteur (si besoin)
|
||
git config user.name "${GIT_USER_NAME:-Dan Allaire}"
|
||
git config user.email "${GIT_USER_EMAIL:-dan@chezlepro.ca}"
|
||
|
||
# 1) GOV/CONTRIB/SECURITY
|
||
cat > GOVERNANCE.md <<'MD'
|
||
# Gouvernance — Alliance Boréale
|
||
- Le présent dépôt fait foi. Toute évolution se fait par PR et revue.
|
||
- Décision: consensus simple; en cas d’égalité, maintien du statu quo.
|
||
- Versions: tags `vYYYY.M` (ex: v2025.1) publiés après ratification.
|
||
- Sécurité: gestion PKI fédérative; rotation régulière; CRL partagées.
|
||
- Transversal: neutralité, interopérabilité, souveraineté, traçabilité.
|
||
MD
|
||
|
||
cat > CONTRIBUTING.md <<'MD'
|
||
# Contribuer
|
||
1. Fork/branche: `feat/...`, `fix/...`, `docs/...`.
|
||
2. Respecter la charte DNS/PKI et le plan IP v3.
|
||
3. Mettre à jour la doc (`docs/`) si comportement/standard change.
|
||
4. Lint YAML: `yamllint` (via CI), SSOT: `node configure/export.mjs`.
|
||
5. Tests: `node configure/tests/test.mjs`.
|
||
MD
|
||
|
||
cat > SECURITY.md <<'MD'
|
||
# Sécurité
|
||
- Signaler une vulnérabilité: ouvrir un ticket privé ou contacter l’équipe sécurité.
|
||
- Secrets: jamais dans le dépôt; utiliser un coffre (ex: Vault).
|
||
- Certificats: autorité PKI fédérative + ACME si public.
|
||
- Rotation clés/certificats: semestrielle (au minimum).
|
||
MD
|
||
|
||
# 2) CODEOWNERS + templates (Forgejo lit .gitea/ aussi)
|
||
mkdir -p .gitea/ISSUE_TEMPLATE
|
||
cat > .gitea/CODEOWNERS <<'TXT'
|
||
# CODEOWNERS — réviseurs par défaut
|
||
* @danallaire
|
||
docs/** @danallaire
|
||
specs/** @danallaire
|
||
configure/** @danallaire
|
||
TXT
|
||
|
||
cat > .gitea/ISSUE_TEMPLATE/bug_report.md <<'MD'
|
||
---
|
||
name: Bug
|
||
about: Rapport de bogue
|
||
---
|
||
**Comportement attendu**
|
||
**Comportement observé**
|
||
**Reproduire**
|
||
1.
|
||
2.
|
||
3.
|
||
**Contexte** (OS, version, logs)
|
||
MD
|
||
|
||
cat > .gitea/ISSUE_TEMPLATE/feature_request.md <<'MD'
|
||
---
|
||
name: Demande de fonctionnalité
|
||
about: Proposition d'amélioration
|
||
---
|
||
**Problème à résoudre**
|
||
**Solution proposée**
|
||
**Impacts (doc, SSOT, CI)**
|
||
MD
|
||
|
||
cat > .gitea/pull_request_template.md <<'MD'
|
||
# Objet
|
||
- [ ] Code/Docs conformes aux standards (DNS/PKI, IP v3)
|
||
- [ ] SSOT export ok (`node configure/export.mjs`)
|
||
- [ ] Doc mise à jour
|
||
**Explication courte**
|
||
MD
|
||
|
||
# 3) Makefile utile
|
||
cat > Makefile <<'MK'
|
||
SHELL := /bin/bash
|
||
.PHONY: all ssot docs test release
|
||
|
||
all: ssot docs
|
||
|
||
ssot:
|
||
@node configure/export.mjs || (echo "Run: npm -C configure i"; exit 1)
|
||
@echo "✅ SSOT exports → ./out"
|
||
|
||
docs:
|
||
@mkdocs build --strict
|
||
@echo "✅ Docs build → site/"
|
||
|
||
test:
|
||
@node configure/tests/test.mjs
|
||
|
||
release:
|
||
@[ -n "$$V" ] || (echo "Usage: make release V=2025.1"; exit 1)
|
||
git tag -a "v$$V" -m "release v$$V"
|
||
git push origin "v$$V"
|
||
MK
|
||
|
||
# 4) CI : ajoute un job SSOT + tests (conserve l’existant)
|
||
cat > .forgejo/workflows/ci.yml <<'YML'
|
||
name: CI
|
||
on:
|
||
push: { branches: ["main"] }
|
||
pull_request:
|
||
jobs:
|
||
yaml-lint:
|
||
runs-on: docker
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: yamllint
|
||
uses: ibiqlik/action-yamllint@v3
|
||
ssot-export:
|
||
runs-on: docker
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: actions/setup-node@v4
|
||
with: { node-version: '20' }
|
||
- run: cd configure && npm ci || npm i
|
||
- run: node configure/export.mjs
|
||
tests:
|
||
runs-on: docker
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: actions/setup-node@v4
|
||
with: { node-version: '20' }
|
||
- run: cd configure && npm ci || npm i
|
||
- run: node configure/tests/test.mjs
|
||
docs:
|
||
runs-on: docker
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: actions/setup-python@v5
|
||
with: { python-version: '3.11' }
|
||
- run: pip install mkdocs
|
||
- run: mkdocs build --strict
|
||
YML
|
||
|
||
# 5) commit(s) propres
|
||
git add GOVERNANCE.md CONTRIBUTING.md SECURITY.md .gitea Makefile .forgejo/workflows/ci.yml
|
||
git commit -m "gov/docs: constitution + règles de contribution/sécurité + CODEOWNERS + CI"
|
||
git push
|
||
echo "✅ Polish pack appliqué."
|
||
|