Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passage vers un nouveau design et système #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 45 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Deploy

permissions:
contents: write

on:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'

- name: Install dependencies
run: make install

- name: Build site
run: make build

- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: build
clean: true
14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/_site
/.sass-cache
/.jekyll-metadata
/docker-compose.override.yml
/_config_dev.yml
public/app.css
public/webfonts/
public/img/logo_simple.png
public/img/logo_text.png

build/

vendor/
node_modules/
24 changes: 0 additions & 24 deletions 404.html

This file was deleted.

30 changes: 0 additions & 30 deletions Gemfile

This file was deleted.

74 changes: 0 additions & 74 deletions Gemfile.lock

This file was deleted.

91 changes: 80 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,85 @@
.PHONY: \
docker-up
# Colors
COLOR_RESET = \033[0m
COLOR_TARGET = \033[32m
COLOR_TITLE = \033[33m
TEXT_BOLD = \033[1m

.DEFAULT: docker-up
.DEFAULT_GOAL = help
.SILENT: help
help:
printf "\n${COLOR_TITLE}Usage:${COLOR_RESET}\n"
printf " ${COLOR_TARGET}make${COLOR_RESET} [target]\n"
printf "\n"
awk '/^[\w\.@%-]+:/i { \
helpMessage = match(lastLine, /^### (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":") - 1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_TARGET}%-30s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
/^##@.+/ { \
printf "\n${TEXT_BOLD}${COLOR_TITLE}%s${COLOR_RESET}\n", substr($$0, 5); \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)

CURRENT_UID=$(shell id -u)
CURRENT_GID=$(shell id -g)
##@ Setup

docker-up: docker-compose.override.yml _config_dev.yml
CURRENT_UID=$(CURRENT_UID) CURRENT_GID=$(CURRENT_GID) docker-compose up
### Install dependencies
install:
composer install
npm install
make public/webfonts

docker-compose.override.yml:
cp docker-compose.override.yml-dist docker-compose.override.yml
##@ Local development

_config_dev.yml:
cp _config_dev.yml-dist _config_dev.yml
### Start the dev server and watch for changes
watch:
npm run watch

### Automatically recompile CSS
css:
npx tailwindcss -i ./resources/css/app.css -o ./public/app.css --watch

### Start a local development server
serve: public/webfonts logos
php -S localhost:8000 -t public

##@ Building

.PHONY: build
### Build the website
build: logos
# Clean build directory
rm -rf build

# Create directories
mkdir -p build
mkdir -p build/webfonts
mkdir -p build/img

# Copy needed files
cp -r node_modules/@fortawesome/fontawesome-free/webfonts/* build/webfonts
cp -r public/img/* build/img
cp config/CNAME build/CNAME

# Compile CSS
npx tailwindcss -i ./resources/css/app.css -o ./build/app.css --minify

# Generate pages
php bin/build.php index > build/index.html
php bin/build.php 404 > build/404.html

## Hidden targets

public/webfonts:
mkdir -p public/webfonts
cp -r node_modules/@fortawesome/fontawesome-free/webfonts/* public/webfonts

public/img/logo_simple.png:
cp config/logo_simple.png public/img/logo_simple.png

public/img/logo_text.png:
cp config/logo_text.png public/img/logo_text.png

logos: public/img/logo_simple.png public/img/logo_text.png
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Site d'antenne AFUP

Ce site est généré en PHP avec un simple script et un template Twig.

## Setup local

Ce projet utilise **PHP** et **Node**, les versions requises sont présentes dans les fichiers `composer.json` et `package.json`.

Pour lancer l'installation des dépendances :

```bash
make install
```

Il suffit ensuite de lancer le serveur de développement : `make watch`

Cette commande va démarrer deux choses en parallèle :

- un watcher pour le CSS
- un serveur PHP, accessible à cette adresse : http://localhost:8000

## Personalisation de l'antenne

Le système est conçu pour fonctionner avec n'importe quelle antenne. Il suffit de modifier quelques fichiers.

### Configuration

Le fichier `config/config.php` contient les informations de configuration du site. Il permet de spécifier les liens des
réseaux sociaux et autres de l'antenne voulue.

Exemple de configuration :

```php
return Site::configure('Lyon')
->repository('https://github.com/afup/lyon.afup.org')
->twitter('AFUP_Lyon')
->mastodon('https://mastodon.social/@afup')
->bluesky('https://bsky.app/profile/afup.bsky.social')
->linkedIn('https://www.linkedin.com/company/afup-lyon/')
->meetup('https://www.meetup.com/fr-FR/afup-lyon/')
->currentEvent('AFUP Day 2024')
->callForPapers('https://afup.org/call-for-speakers')

// Il est possible de spécifier des liens supplémentaires :

// Pour ajouter un lien dans la section supérieure
->withTopLink(new Link('Exemple de lien', 'https://example.com', 'fa-solid fa-link'))

// Pour ajouter un lien dans la section inférieure
->withBottomLink(new Link("Autre exemple", 'https://example.com', 'fa-solid fa-rocket'))
;
```

### Logos

Le logo de l'antenne doit être présent en deux versions :

- `config/logo_simple.png` : utilisé comme favicon
- `config/logo_text.png` : utilisé dans la page, doit avoir un fond transparent

> [!TIP]
> Les logos des antennes sont disponibles ici : https://identity.afup.org

### Domaine

Le nom de domaine du site est à spécifier dans le fichier `config/CNAME`.

## Génération du site

Pour déployer le site, il faut le générer avec la commande suivante :

```bash
make build
```

Cela va générer un dossier `build` contenant tout ce qu'il faut pour déployer le site.

Le déploiement se fait ensuite via un [workflow GitHub](.github/workflows/build-and-deploy.yml).

## Outils utilisés

- [Twig](https://twig.symfony.com/) pour les templates
- [Tailwind](https://tailwindcss.com/) pour le CSS
- [Concurrently](https://github.com/open-cli-tools/concurrently) pour lancer plusieurs commandes en parallèle
Loading