Files
site_opytex/.gitea/workflows/deploy.yml
Bertrand Benjamin 251d637a7b
All checks were successful
Build and Deploy to MinIO / build-and-deploy (push) Successful in 6m20s
build: mc
2025-09-05 22:25:18 +02:00

76 lines
2.2 KiB
YAML

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_REPOSITORY: ${{ secrets.MINIO_REPOSITORY }}
MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }}
MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }}
run: |
mc alias set storage $MINIO_REPOSITORY $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
- name: Deploy to MinIO - Master branch
env:
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
if: gitea.ref == 'refs/heads/master'
run: |
mc mirror --overwrite --exclude "enseignements/*" ./output/ storage/$MINIO_BUCKET
- name: Deploy to MinIO - Year branches
env:
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
if: gitea.ref != 'refs/heads/master'
run: |
BRANCH_NAME=${GITEA_REF_NAME}
mc mirror --overwrite --remove ./output/ storage/$MINIO_BUCKET/enseignements/${BRANCH_NAME}/