build: split workflow in 2 jobs
This commit is contained in:
@@ -7,8 +7,11 @@ on:
|
||||
- 2025-2026
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
branch-type: ${{ steps.branch-info.outputs.branch-type }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -17,6 +20,15 @@ jobs:
|
||||
submodules: true
|
||||
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
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
@@ -47,6 +59,24 @@ jobs:
|
||||
export MAGICK_HOME=/usr
|
||||
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
|
||||
run: |
|
||||
wget https://dl.min.io/client/mc/release/linux-amd64/mc
|
||||
@@ -64,7 +94,7 @@ jobs:
|
||||
- name: Deploy to MinIO - Master branch
|
||||
env:
|
||||
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
|
||||
if: gitea.ref == 'refs/heads/master'
|
||||
if: needs.build.outputs.branch-type == 'master'
|
||||
run: |
|
||||
mc mirror --overwrite --exclude "enseignements/*" ./output/ storage/$MINIO_BUCKET
|
||||
|
||||
@@ -72,6 +102,6 @@ jobs:
|
||||
env:
|
||||
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
|
||||
BRANCH_NAME: ${{ gitea.ref_name }}
|
||||
if: gitea.ref != 'refs/heads/master'
|
||||
if: needs.build.outputs.branch-type == 'year'
|
||||
run: |
|
||||
mc mirror --overwrite --remove ./output/ storage/$MINIO_BUCKET/enseignements/${BRANCH_NAME}/
|
||||
|
Reference in New Issue
Block a user