86 lines
2.2 KiB
YAML
86 lines
2.2 KiB
YAML
name: Publish content
|
|
run-name: ${{ gitea.actor }} is pushing 🚀
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
ACCESS_KEY: ${{ secrets.minio_access_key }}
|
|
SECRET_KEY: ${{ secrets.minio_secret_key }}
|
|
MINIO_BUCKET: opytex.org
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Site above repository
|
|
run: |
|
|
cd ..
|
|
git clone ${{ vars.site_origin }} Site
|
|
cd Site
|
|
git checkout ${{ vars.year }}
|
|
ln -s ../${{ vars.year }} content
|
|
|
|
- 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 ghostscript
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
pwd
|
|
cd ../Site
|
|
pip install --no-cache-dir -r requirements.txt
|
|
|
|
- name: Build site
|
|
run: |
|
|
cd ../Site
|
|
export MAGICK_HOME=/usr
|
|
pelican ./content/ -o /output -s publishconf.py --relative-urls
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: site-build
|
|
path: /output
|
|
retention-days: 1
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
steps:
|
|
- name: Download build artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: site-build
|
|
path: output/
|
|
|
|
- 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: ${{ vars.MINIO_ENDPOINT }}
|
|
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 - Year branches
|
|
run: |
|
|
mc mirror --overwrite --remove ./output/ storage/$MINIO_BUCKET/enseignements/${{ vars.year }}/
|