build: add deployment

This commit is contained in:
2025-09-05 22:09:43 +02:00
parent cadbaa163e
commit 711fbb12d5

View File

@@ -0,0 +1,70 @@
name: Build and Deploy to MinIO
on:
push:
branches:
# - master
- 2025-2026
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y imagemagick libmagickwand-dev
- name: Install Python dependencies
run: |
pip install --no-cache-dir -r requirements.txt
- name: Setup content directory for year branches
if: gitea.ref != 'refs/heads/master'
run: |
BRANCH_NAME=${GITEA_REF_NAME}
if [ ! -L content ]; then
rm -rf content
git clone https://git.opytex.org/lafrite/${BRANCH_NAME}.git content
fi
- name: Build site
run: |
export MAGICK_HOME=/usr
pelican ./content/ -o ./output -s publishconf.py --relative-urls
- name: Install MinIO client
run: |
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
sudo mv mc /usr/local/bin/
- name: Configure MinIO client
env:
MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }}
MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }}
run: |
mc alias set storage https://storage.opytex.org $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
- name: Deploy to MinIO - Master branch
if: gitea.ref == 'refs/heads/master'
run: |
mc mirror --overwrite ./output/ storage/opytex.org/
- name: Deploy to MinIO - Year branches
if: gitea.ref != 'refs/heads/master'
run: |
BRANCH_NAME=${GITEA_REF_NAME}
mc mirror --overwrite --remove ./output/ storage/opytex.org/enseignements/${BRANCH_NAME}/