Skip to content

Commit

Permalink
Readme rendering for a better home page (ia-z#77)
Browse files Browse the repository at this point in the history
* Readme rendering for a better home page

* Keep the link between rendering and build

* Target main as default branch

* Scheduling on deployment pipeline

* Use custom secret to make deplyment

* Go for pixel size for rendering

* New stage to commit and push

Co-authored-by: Lucas Pauzies <[email protected]>
  • Loading branch information
LPauzies and Lucas Pauzies authored Jun 27, 2022
1 parent 65a2f3c commit 672da79
Show file tree
Hide file tree
Showing 11 changed files with 914 additions and 26 deletions.
74 changes: 74 additions & 0 deletions .github/dynamic-rendering/main.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<h1 align="center">{{ title }}</h1>
<p align="center">
Cours & Ressources pour l'IA {{#isBuilding}} (En construction) {{/isBuilding}}
</p>
<p align="center">
<a href="https://discord.gg/nmnuf6USVT">
<img alt="discord server invitation link" src="https://cdn.cdnlogo.com/logos/d/47/discord.svg" style="width: 25%">
</a>
</p>

## Sommaire

- [Presentation](#presentation)
- [Perimètre](#perimètre)
- [Organisation](#organisation)
- [Communauté](#communauté)
- [Equipe](#equipe)

---

## Presentation
**{{ title }}** est une plateforme en ligne offrant un enseignement complet en data science. Elle est destinée à un public ayant un bagage en mathématiques, python et sciences informatiques de niveau supérieur ou égal au BAC.

{{ title }} est conçue pour fournir des enseignements destinés à un public déjà sensibilisé et dans l’optique de fournir la meilleure qualité de support pédagogique et didactique.

#### Perimètre
- La plateforme web a pour objectif de former et sensibiliser à la data science
- Les enseignements apportés sont segmentés en notions, elles-mêmes découpées en cours
- Les cours ont pour but de donner une information claire, concise au possible et illustrée par des exemples
- Possibilité d’ajouter des ressources externes à la fin de chaque cours pour approfondir les cours disponibles sur la plateforme
- La plateforme web recense tous les éléments cités au-dessus
- La plateforme web a pour unique but d’être éducative. Elle ne véhicule donc ni promotion, ni opinions


---
## Organisation

- Nouveau membre du projet {{ title }} ?

* Accèdez au document d'onboarding : ia-z/organisation/onboarding.md
* Accèdez au document de bonnes pratiques git : ia-z/organisation/workflow_git.md
* Accèdez au template d'écriture de cours : ia-z/organisation/template_chapitre.md

- Pour suggérer un nouveau cours ou pour toutes suggestions, réagissez à ce fil de discussion pour nous en faire part : https://github.com/ia-z/ia-z/discussions/categories/ideas ou créez une issue détaillée avec le bon tag associé.
- Si un cours contient une erreur ou vous rencontrez un problème technique, ouvrez une issue dédiée puis soumettez une PR directement.

---
## Communauté

- Nous communiquons sur le serveur de la communauté [![discord](https://img.shields.io/discord/638695942786121758?label=DefendIntelligence&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/nmnuf6USVT).
Commencez par accepter le réglement et vous présenter dans le channel [#présentation](https://discord.gg/v4nKnCcEqF) pour accéder aux autres salons.


## Equipe

### Fondateur

<p style="margin-top: 2px">
<a href="https://github.com/anisayari" style="display: flex; align-items : center; text-decoration: none; color: inherit;">
<img src="https://avatars.githubusercontent.com/u/10380894?v=4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;Anis Ayari
</a>
</p>

### Contributeurs

<p style="display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px">
{{#contributors}}
<a href="{{ github_profile }}" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: {{ width_markup }}">
<img src="{{ avatar }}" style="width: {{ width_avatar }}; margin-top: 2px">
&nbsp;&nbsp;{{ login }}
</a>
{{/contributors}}
</p>
48 changes: 48 additions & 0 deletions .github/dynamic-rendering/render.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const Mustache = require("mustache");
const fs = require("fs");
const request = require("sync-request");
const MUSTACHE_FILE = "./.github/dynamic-rendering/main.mustache";
const README_FILE = "README.md"

/** Functions to retrieve data from github API */

function getContributors() {
let apiEndPoint = "https://api.github.com/repos/ia-z/ia-z/contributors"
let headers = { "User-Agent": "request" }
let response = request("GET", apiEndPoint, { headers })
let parsedResponse = JSON.parse(response.getBody("utf8"))
return parsedResponse
.filter(contributor => contributor.type.toLowerCase() !== "bot")
.sort((c1, c2) => c2.contributions - c1.contributions)
.map(contributor => {
return {
avatar: contributor.avatar_url,
login: contributor.login,
github_profile: contributor.html_url,
width_markup: "150px",
width_avatar: "36px"
}
})
}

/** Define DATA to be rendered through Mustache */

let DATA = {
title: "IA-Z",
isBuilding: true,
contributors: getContributors()
}

/**
* Generate README from Mustache Template
* @param {Object} mustacheData
*/
function generateReadMe(mustacheData) {
fs.readFile(MUSTACHE_FILE, (err, data) => {
if (err) throw err;
const output = Mustache.render(data.toString(), mustacheData);
fs.writeFileSync(README_FILE, output);
});
}

generateReadMe(DATA);
36 changes: 35 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,44 @@ on:
branches:
- main

# Schedule the job to everyday to refresh dynamic first page
schedule:
- cron: '0 0 * * *'

jobs:

build:
rendering:
name: Dynamic rendering
runs-on: ubuntu-latest
steps:
# Checkout from main
- name: Checkout current repository to Master branch
uses: actions/checkout@v1
# Setup Node version
- name: Setup NodeJs 16.x
uses: actions/setup-node@v1
with:
node-version: '16.x'
# Cache the node_module to avoid build explosion
- name: Cache dependencies and build outputs to improve workflow execution time.
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-js-${{ hashFiles('package-lock.json') }}
# Install dependencies for dynamic rendering
- name: Install dependencies
run: npm install
# Generate the README.md file
- name: Generate README.md file
run: node .github/dynamic-rendering/render.js
- name: Commit and Push new README.md to the repository
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

build:
# Deploy only if build succeeded
needs: [rendering]
name: Build
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ venv/

# Notebook outputs
**/iframe_figures/

# Mustache rendering
node_modules/
76 changes: 59 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<h3 align="center">iA-Z</h3>
<h1 align="center">IA-Z</h1>
<p align="center">
Cours & Ressources pour l'IA (en construction)
Cours & Ressources pour l'IA (En construction)
</p>
<p align="center">
<a href="https://discord.gg/nmnuf6USVT">
<img alt="discord server invitation link" src="https://discord.com/assets/cb48d2a8d4991281d7a6a95d2f58195e.svg" style="width: 13%; height: 15%">
</a>
<a href="https://ia-z.github.io/ia-z/">
<img src="https://pages.github.com/images/logo.svg" style="width: 15%; height: 15%">
<img alt="discord server invitation link" src="https://cdn.cdnlogo.com/logos/d/47/discord.svg" style="width: 25%">
</a>
</p>

## Statut

[![pages-build-deployment](https://github.com/ia-z/ia-z/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/ia-z/ia-z/actions/workflows/pages/pages-build-deployment)

## Sommaire

- [Presentation](#presentation)
Expand All @@ -26,9 +19,9 @@
---

## Presentation
**iA-Z** est une plateforme en ligne offrant un enseignement complet en data science. Elle est destinée à un public ayant un bagage en mathématiques, python et sciences informatiques de niveau supérieur ou égal au BAC.
**IA-Z** est une plateforme en ligne offrant un enseignement complet en data science. Elle est destinée à un public ayant un bagage en mathématiques, python et sciences informatiques de niveau supérieur ou égal au BAC.

iA-Z est conçue pour fournir des enseignements destinés à un public déjà sensibilisé et dans l’optique de fournir la meilleure qualité de support pédagogique et didactique.
IA-Z est conçue pour fournir des enseignements destinés à un public déjà sensibilisé et dans l’optique de fournir la meilleure qualité de support pédagogique et didactique.

#### Perimètre
- La plateforme web a pour objectif de former et sensibiliser à la data science
Expand All @@ -42,7 +35,7 @@ iA-Z est conçue pour fournir des enseignements destinés à un public déjà se
---
## Organisation

- Nouveau membre du projet ia-z ?
- Nouveau membre du projet IA-Z ?

* Accèdez au document d'onboarding : ia-z/organisation/onboarding.md
* Accèdez au document de bonnes pratiques git : ia-z/organisation/workflow_git.md
Expand All @@ -60,7 +53,56 @@ Commencez par accepter le réglement et vous présenter dans le channel [#prése

## Equipe

- [Anis Ayari](https://www.github.com/anisayari) (fondateur de la communauté DefendIntelligence)
- [Admins](https://github.com/orgs/ia-z/teams/admins/members) (team pour tout ce qui est management)
- [Reviewers](https://github.com/orgs/ia-z/teams/reviewers/members) (décident du plan, contenu et valident les PRs)
- [Contributors](https://github.com/ia-z/ia-z/graphs/contributors)
### Fondateur

<p style="margin-top: 2px">
<a href="https://github.com/anisayari" style="display: flex; align-items : center; text-decoration: none; color: inherit;">
<img src="https://avatars.githubusercontent.com/u/10380894?v=4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;Anis Ayari
</a>
</p>

### Contributeurs

<p style="display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px">
<a href="https:&#x2F;&#x2F;github.com&#x2F;Studioaxs" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;82153591?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;Studioaxs
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;MohamedBsh" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;40428556?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;MohamedBsh
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;Otsutsukii" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;38628261?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;Otsutsukii
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;Futurne" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;25549037?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;Futurne
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;LPauzies" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;26601532?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;LPauzies
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;EHadoux" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;1655646?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;EHadoux
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;Serenalyw" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;65224852?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;Serenalyw
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;aminenaim" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;74571889?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;aminenaim
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;adriengoleb" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;55838700?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;adriengoleb
</a>
<a href="https:&#x2F;&#x2F;github.com&#x2F;MHaurel" style="display: flex; align-items : center; text-decoration: none; color: inherit; width: 150px">
<img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;54206618?v&#x3D;4" style="width: 36px; margin-top: 2px">
&nbsp;&nbsp;MHaurel
</a>
</p>
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

title: IA-Z
author: Communauté IA-Z
logo: logo.jpeg
exclude_patterns: [_build, "**.ipynb_checkpoints", .venv, venv, organisation]
logo: _static/img/logo.jpeg
exclude_patterns: [_build, "**.ipynb_checkpoints", .venv, venv, organisation, node_modules, package.json, package-lock.json, .local, .github]

# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
Expand Down
File renamed without changes
3 changes: 0 additions & 3 deletions _static/myfile.css

This file was deleted.

3 changes: 0 additions & 3 deletions compile.sh

This file was deleted.

Loading

0 comments on commit 672da79

Please sign in to comment.