Skip to content

Commit

Permalink
[🔁 CI] Move to github action
Browse files Browse the repository at this point in the history
[🔁 CI] Remove LC_ALL set

[CI} Add content clone

[CI] Update locale

[CI] Fix CI name in worflow

[CI] Remove top read articles

[CI] Install node-sass

[CI] Add token permission to push github pages

[CI] Try changing upload version

[CI] Try fixing permissions
  • Loading branch information
ebanDev committed Mar 24, 2024
1 parent 4ce8f00 commit 8c89a6b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 30 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Blog CI/CD

on:
push:
branches:
- master
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Setup NodeJS
uses: actions/setup-node@v4
- name: Install node-sass
run: npm install -g node-sass
- name: Set locale
run: |
sudo locale-gen fr_FR.UTF-8
sudo update-locale LANG=fr_FR.UTF-8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build in python
run: |
rm -rf content
mkdir content
git clone https://github.com/i-learned-eu/content-fr content
pelican -o output/ --fatal warnings
rm -rf ./output/theme/.webassets-cache
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./output

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions pelicanconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
STATIC_PATHS = ['static']
THEME_STATIC_PATHS = ['static']

DIRECT_TEMPLATES = ['index', 'latest', 'most_read', 'search']
DIRECT_TEMPLATES = ['index', 'latest', 'search']

PLUGIN_PATHS = ['./pelican-plugins']
PLUGINS = ['webassets', 'sitemap', 'readtime', 'pelican_katex', 'subcategory', 'tipue_search', 'top_read', 'to_json', 'add_class']
PLUGINS = ['webassets', 'sitemap', 'readtime', 'pelican_katex', 'subcategory', 'tipue_search', 'to_json', 'add_class']

CATEGORY_PRETTY_NAME = {"Cybersécurité": "🔒",
"Pensées du libre": "🔖", "Réseau": "📶", "Sysadmin": "🖥", "Sciences": "🔬"}
Expand Down
2 changes: 0 additions & 2 deletions theme/templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ <h1 class="articleTitle">{{ article.title }}</h1>
<p>Lecture {{ article.readtime.minutes }}mn</p>
</div>
<article>{{ article.content }}</article>
<script defer src="https://commento.ilearned.eu/js/commento.js" data-no-websockets="true"></script>
<div id="commento"></div>
</div>
{% endblock %}
26 changes: 0 additions & 26 deletions theme/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,6 @@ <h3><a href="{{ article.url }}">{{ article.title }}</a></h3>
</div>
<a href="/latest.html" class="btn btn-primary">Voir plus</a>
</div>

<div class="card" id="mostRead">
<div class="title">
<h2>📈 Les plus lus</h2>
</div>
<div class="articles">
{% for article in TOP_READ[:4] %}
<div class="article">
<div class="author">
<img
src="https://cdn.ilearned.eu/img/contributors/{{ article.author|string|lower }}.webp"
alt="Photo de profil de {{ article.author }}"
/>
<a href="/author/{{ article.author|lower }}.html">{{ article.author }}</a>
</div>
<h3><a href="{{ article.url }}">{{ article.title }}</a></h3>
<div class="metadata">
<time class="published"> {{ article.locale_date }} </time>
<b>·</b>
<p>Lecture {{ article.readtime }}mn</p>
</div>
</div>
{% endfor %}
</div>
<a href="/most_read.html" class="btn btn-primary">Voir plus</a>
</div>
</section>

<section id="categories">
Expand Down

0 comments on commit 8c89a6b

Please sign in to comment.