diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3353b7a..1942a9d 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -24,22 +24,18 @@ jobs: ssh raphix@alpha.raphix.fr " set -e; APP_DIR=/home/gitlab-ci/chopin-frontend; + FRONTEND_DIR=/home/gitlab-ci/frontend/dist; REPO_URL=https://git.raphix.fr/subsonics/chopin-frontend; BRANCH=main; echo '[Frontend-Deploy] - START'; + # Nettoyage ancien dossier temporaire + rm -rf \$APP_DIR; mkdir -p \$APP_DIR; - if [ ! -d \$APP_DIR/.git ]; then - echo 'Cloning repository...'; - git clone -b \$BRANCH \$REPO_URL \$APP_DIR; - else - echo 'Updating repository...'; - cd \$APP_DIR; - git fetch origin; - git reset --hard origin/\$BRANCH; - fi; + echo 'Cloning repository...'; + git clone -b \$BRANCH \$REPO_URL \$APP_DIR; cd \$APP_DIR; @@ -49,5 +45,13 @@ jobs: echo 'Building app...'; npm run build; + echo 'Deploying build to frontend/dist...'; + mkdir -p \$FRONTEND_DIR; + rm -rf \$FRONTEND_DIR/*; + cp -r dist/* \$FRONTEND_DIR/; + + echo 'Cleaning up temporary build directory...'; + rm -rf \$APP_DIR; + echo '[Frontend-Deploy] - DONE'; "