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 env: BRANCH_NAME: ${{ vars.GITEA_REF_NAME }} if: gitea.ref != 'refs/heads/master' run: | echo "Branch name: $BRANCH_NAME" echo "Testing URL: https://git.opytex.org/Cours/${BRANCH_NAME}.git" curl -I "https://git.opytex.org/Cours/${BRANCH_NAME}.git" || echo "URL not accessible" rm -rf content git clone https://git.opytex.org/Cours/${BRANCH_NAME}.git content - 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 }} BRANCH_NAME: ${{ vars.GITEA_REF_NAME }} if: gitea.ref != 'refs/heads/master' run: | mc mirror --overwrite --remove ./output/ storage/$MINIO_BUCKET/enseignements/${BRANCH_NAME}/