build: split workflow in 2 jobs
This commit is contained in:
@@ -7,9 +7,12 @@ on:
|
|||||||
- 2025-2026
|
- 2025-2026
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
branch-type: ${{ steps.branch-info.outputs.branch-type }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -17,6 +20,15 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set branch type
|
||||||
|
id: branch-info
|
||||||
|
run: |
|
||||||
|
if [ "${{ gitea.ref }}" = "refs/heads/master" ]; then
|
||||||
|
echo "branch-type=master" >> $GITEA_OUTPUT
|
||||||
|
else
|
||||||
|
echo "branch-type=year" >> $GITEA_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
@@ -47,6 +59,24 @@ jobs:
|
|||||||
export MAGICK_HOME=/usr
|
export MAGICK_HOME=/usr
|
||||||
pelican ./content/ -o ./output -s publishconf.py --relative-urls
|
pelican ./content/ -o ./output -s publishconf.py --relative-urls
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
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@v4
|
||||||
|
with:
|
||||||
|
name: site-build
|
||||||
|
path: output/
|
||||||
|
|
||||||
- name: Install MinIO client
|
- name: Install MinIO client
|
||||||
run: |
|
run: |
|
||||||
wget https://dl.min.io/client/mc/release/linux-amd64/mc
|
wget https://dl.min.io/client/mc/release/linux-amd64/mc
|
||||||
@@ -64,7 +94,7 @@ jobs:
|
|||||||
- name: Deploy to MinIO - Master branch
|
- name: Deploy to MinIO - Master branch
|
||||||
env:
|
env:
|
||||||
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
|
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
|
||||||
if: gitea.ref == 'refs/heads/master'
|
if: needs.build.outputs.branch-type == 'master'
|
||||||
run: |
|
run: |
|
||||||
mc mirror --overwrite --exclude "enseignements/*" ./output/ storage/$MINIO_BUCKET
|
mc mirror --overwrite --exclude "enseignements/*" ./output/ storage/$MINIO_BUCKET
|
||||||
|
|
||||||
@@ -72,6 +102,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
|
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
|
||||||
BRANCH_NAME: ${{ gitea.ref_name }}
|
BRANCH_NAME: ${{ gitea.ref_name }}
|
||||||
if: gitea.ref != 'refs/heads/master'
|
if: needs.build.outputs.branch-type == 'year'
|
||||||
run: |
|
run: |
|
||||||
mc mirror --overwrite --remove ./output/ storage/$MINIO_BUCKET/enseignements/${BRANCH_NAME}/
|
mc mirror --overwrite --remove ./output/ storage/$MINIO_BUCKET/enseignements/${BRANCH_NAME}/
|
||||||
|
|||||||
Reference in New Issue
Block a user