(English version below)
EcoIndex est un outil du Collectif Conception Numérique Responsable
Ce dépôt contient le site web www.ecoindex.fr, réalisé avec Astro.
La contribution à l’ensemble de nos outils est ouverte à tout le monde, après s’être fait connaître du collectif.
Nous recherchons des personnes ayant des connaissances dans la tech, et dans le domaine de la traduction.
Pour faciliter les échanges, un channel #ecoIndex est dédié au projet sur le Mattermost de l’association Green IT.
Le site EcoIndex est réalisé avec Astro (contenu MDX, i18n FR/EN, TypeScript client pour l’analyse et la page résultat).
Les données de référence (couleurs des notes A–G, cibles de score) sont synchronisées depuis
ecoindex_reference.
mise trust # une seule fois, pour activer .mise.toml
mise install- Clonez ce dépôt :
git clone https://github.com/cnumr/EcoIndex.git # ou en SSH : git clone git@github.com:cnumr/EcoIndex.git - Installez les dépendances et lancez le serveur de développement :
bun install bun run dev # http://localhost:4321 - Autres commandes utiles :
bun run build # génère dist/ bun run preview # prévisualise le build bun run test # tests unitaires (Vitest) bun run check # format + lint + typecheck + tests
Les couleurs de notes et les cibles (poids, DOM, requêtes) sont générées depuis la référence officielle :
bun run reference:sync # régénère CSS + targets
bun run reference:check # vérifie (utilisé en CI)Source : JSON distant sur main de ecoindex_reference, ou fichier local via ECOINDEX_REFERENCE_PATH.
src/
├── components/
│ ├── layout/ # Header, Footer, LanguageSwitcher
│ ├── shortcodes/ # Composants de contenu (Hero, Grid, Form…)
│ └── widgets/ # Widgets dont page résultat
├── config/
│ ├── site.ts # Routes i18n, menus, slugs FR/EN
│ ├── api.ts # URL API EcoIndex + viewport d’analyse
│ ├── result-text.ts # Textes / bornes d’affichage page résultat
│ └── ecoindex-targets.ts # Cibles (généré depuis ecoindex_reference)
├── content/
│ ├── fr/ # Pages et widgets FR
│ └── en/ # Pages et widgets EN
├── i18n/ # Chaînes UI
├── layouts/BaseLayout.astro
├── lib/ # Helpers contenu et widgets
├── scripts/ # TS client (API, résultats, dialogues) + *.test.ts
└── styles/ # CSS (dont 0_grade-colors.css généré)
| Section | FR | EN |
|---|---|---|
| Accueil | / |
/en/ |
| Comment ça marche | /comment-ca-marche |
/en/how-it-works |
| Écoconception | /ecoconception |
/en/ecodesign |
| … | voir src/config/site.ts |
Chaque page est composée de fragments Markdown / MDX (_10_*.mdx) chargés par <Widgets />. Les zones nommées utilisent le préfixe _zone-first_.
Quatre workflows GitHub Actions :
| Workflow | Fichier | Déclencheur |
|---|---|---|
| Validation du build | .github/workflows/quality.yml |
ouverture / mise à jour d’une PR |
| Deploy preproduction | .github/workflows/deploy.yml |
push sur main |
| Deploy manual | .github/workflows/deploy-manual.yml |
manuel (workflow_dispatch) |
| Release | .github/workflows/release.yml |
manuel (workflow_dispatch) |
Créer deux Environments GitHub (Settings → Environments) :
preproduction— utilisé par le deploy automatique surmainet le deploy manuelproduction— utilisé par le deploy manuel et le workflow Release
Dans chaque environment, définir les secrets suivants (valeurs propres à la cible) :
| Secret | Description |
|---|---|
RSYNC_PRIVATE_SSH_KEY |
Clé privée SSH pour se connecter au serveur |
RSYNC_KNOWN_HOSTS |
Entrée known_hosts du serveur (évite le prompt host key) |
RSYNC_REMOTE_PORT |
Port SSH |
RSYNC_REMOTE_USER |
Utilisateur SSH |
RSYNC_REMOTE_HOST |
Hôte du serveur |
RSYNC_REMOTE_FOLDER |
Chemin distant où synchroniser le contenu de dist/ |
Optionnel (au niveau repository ou environment production) :
| Secret | Description |
|---|---|
MATTERMOST_RELEASE_URL |
Webhook Mattermost pour notifier une release (si absent, la notif est ignorée) |
Les jobs de deploy ont besoin des droits d’accès aux environments (éventuellement protection rules / reviewers sur production).
Le front est servi par Caddy (file_server sur /srv/preprod et /srv/prod). Pour les bonnes pratiques RWEB 0075 / 0076, appliquer le snippet versionné deploy/Caddyfile.snippet sur l’hôte (importer ecoindex_static dans www.ecoindex.fr et site-tmp.ecoindex.fr), puis recharger Caddy. Ce fichier n’est pas déployé par rsync.
Le workflow Validation du build s’exécute automatiquement. Il :
- installe les runtimes (mise) et les dépendances (
bun install --frozen-lockfile) - vérifie la sync
ecoindex_reference(reference:check) - lance
format:check,lint,typecheck,test, puisbuild
Aucun déploiement n’est effectué. La PR peut être mergée une fois ces checks verts.
Le workflow Deploy preproduction se déclenche sur le push vers main. Il :
- vérifie
reference:checket build le site - déploie
dist/par rsync/SSH vers l’environmentpreproduction
La production n’est pas mise à jour à ce stade.
Pour redéployer une branche / un tag sans bump de version ni GitHub Release :
- Aller dans Actions → Deploy manual → Run workflow
- Choisir la branche ou le tag à déployer
- Choisir la cible :
preproductionouproduction - Lancer le workflow
Le job build le site puis synchronise dist/ via rsync vers l’environment choisi (mêmes secrets SSH). Utile pour rejouer un deploy préprod, ou pousser en prod un commit déjà tagué sans passer par Release.
Release reste le chemin nominal pour la prod (bump + tag + changelog + Mattermost). Le deploy manuel prod ne crée ni tag ni release GitHub.
- Aller dans Actions → Release → Run workflow
- Choisir la branche
mainet le bump semver :patch/minor/major - Lancer le workflow
Enchaînement automatique :
- Bump — lit la version dans
package.json, l’incrémente, commit (chore: bump version to X.Y.Z), pousse et crée le tagvX.Y.Z - Deploy — checkout du tag, build, rsync vers l’environment
production - GitHub Release — génère un changelog depuis le tag précédent sur l’historique courant (les tags Hugo hors historique Astro sont ignorés), publie la release
vX.Y.Z, puis notifie Mattermost siMATTERMOST_RELEASE_URLest défini
Le site internet www.ecoindex.fr, ainsi que les règles d’analyses et de calcul de l’ecoindex sont publiés sous licence Creative Commons BY-NC-ND. Cela signifie que vous pouvez l’utiliser librement pour des utilisations non commerciales, à la condition de maintenir la paternité du contenu, via un lien vers https://www.ecoindex.fr
EcoIndex is a tool from the french Collectif Conception Numérique Responsable
This repository hosts the www.ecoindex.fr website, built with Astro.
All of our tools are open to contributions from everybody, after having contacted the collective.
We seek people with technical skills, and people able to make translations and localizations.
There’s a dedicated #ecoIndex Mattermost channel for the project.
The EcoIndex website is built with Astro (MDX content, FR/EN i18n, client TypeScript for analysis and the result page).
Reference data (grade A–G colors, score targets) is synced from
ecoindex_reference.
mise trust # once, to enable .mise.toml
mise install- Clone this repository:
git clone https://github.com/cnumr/EcoIndex.git # or via SSH: git clone git@github.com:cnumr/EcoIndex.git - Install dependencies and start the dev server:
bun install bun run dev # http://localhost:4321 - Useful commands:
bun run build # outputs dist/ bun run preview # preview the production build bun run test # unit tests (Vitest) bun run check # format + lint + typecheck + tests
Grade colors and score targets are generated from the official reference:
bun run reference:sync # regenerate CSS + targets
bun run reference:check # verify (used in CI)Source: remote JSON on ecoindex_reference main, or a local file via ECOINDEX_REFERENCE_PATH.
Four GitHub Actions workflows:
| Workflow | File | Trigger |
|---|---|---|
| Validation du build | .github/workflows/quality.yml |
PR opened / updated |
| Deploy preproduction | .github/workflows/deploy.yml |
push to main |
| Deploy manual | .github/workflows/deploy-manual.yml |
manual (workflow_dispatch) |
| Release | .github/workflows/release.yml |
manual (workflow_dispatch) |
Create two GitHub Environments (Settings → Environments):
preproduction— used by the automatic deploy onmainand the manual deployproduction— used by the manual deploy and the Release workflow
In each environment, set these secrets (values specific to that target):
| Secret | Description |
|---|---|
RSYNC_PRIVATE_SSH_KEY |
SSH private key used to connect to the server |
RSYNC_KNOWN_HOSTS |
Server known_hosts entry (avoids host-key prompts) |
RSYNC_REMOTE_PORT |
SSH port |
RSYNC_REMOTE_USER |
SSH user |
RSYNC_REMOTE_HOST |
Server host |
RSYNC_REMOTE_FOLDER |
Remote path where dist/ content is synced |
Optional (repository level or production environment):
| Secret | Description |
|---|---|
MATTERMOST_RELEASE_URL |
Mattermost webhook for release notifications (skipped if unset) |
Deploy jobs need access to those environments (you may add protection rules / reviewers on production).
The front is served by Caddy (file_server on /srv/preprod and /srv/prod). For RWEB 0075 / 0076, apply the versioned snippet deploy/Caddyfile.snippet on the host (import ecoindex_static in www.ecoindex.fr and site-tmp.ecoindex.fr), then reload Caddy. This file is not deployed by rsync.
The Validation du build workflow runs automatically. It:
- installs runtimes (mise) and dependencies (
bun install --frozen-lockfile) - checks
ecoindex_referencesync (reference:check) - runs
format:check,lint,typecheck,test, thenbuild
Nothing is deployed. Merge once those checks are green.
The Deploy preproduction workflow runs on push to main. It:
- runs
reference:checkand builds the site - deploys
dist/via rsync/SSH to thepreproductionenvironment
Production is not updated at this stage.
To redeploy a branch / tag without a version bump or GitHub Release:
- Go to Actions → Deploy manual → Run workflow
- Select the branch or tag to deploy
- Choose the target:
preproductionorproduction - Start the workflow
The job builds the site then rsyncs dist/ to the selected environment (same SSH secrets). Useful to replay a preprod deploy, or push to prod an already-tagged commit without running Release.
Release remains the nominal path for production (bump + tag + changelog + Mattermost). A manual prod deploy does not create a tag or GitHub Release.
- Go to Actions → Release → Run workflow
- Select branch
mainand the semver bump:patch/minor/major - Start the workflow
Automatic sequence:
- Bump — increments
package.json, commits (chore: bump version to X.Y.Z), pushes, and creates tagvX.Y.Z - Deploy — checks out the tag, builds, rsyncs to the
productionenvironment - GitHub Release — builds a changelog since the previous tag on the current history (Hugo tags outside the Astro history are ignored), publishes release
vX.Y.Z, then notifies Mattermost ifMATTERMOST_RELEASE_URLis set
The website www.ecoindex.fr, as well as the ecoindex analysis and calculation rules are published under Creative Commons BY-NC-ND license. This means that you can use it freely for non-commercial uses, on condition that you maintain the authorship of the content, via a link to https://www.ecoindex.fr
