From 2cb3dc02ae71c282b8937d2a49c2d44d29cea390 Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Sat, 22 Jun 2024 11:09:10 +0100 Subject: [PATCH] Changing deployment workflows to clear out old build before copying new build to web directory --- .github/workflows/autodeploy.yml | 4 +--- .github/workflows/manualdeploy.yml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/autodeploy.yml b/.github/workflows/autodeploy.yml index b50d93aa..c1c676a5 100644 --- a/.github/workflows/autodeploy.yml +++ b/.github/workflows/autodeploy.yml @@ -30,14 +30,12 @@ jobs: export NVM_DIR=~/.nvm source ~/.nvm/nvm.sh npm install - npm audit fix npm start cd ../coriolis npm install - npm audit fix npm run build - name: Deploy the code shell: bash run: | cd ../coriolis - if [ {BRANCH_NAME} == "beta" ]; then sudo -u www-data cp -r ./build/* /var/www/beta.coriolis.io/; else sudo -u www-data cp -r ./build/* /var/www/coriolis.io/; fi + if [ {BRANCH_NAME} == "beta" ]; then sudo rm -Rf /var/www/beta.coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/beta.coriolis.io/; else sudo rm -Rf /var/www/coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/coriolis.io/; fi diff --git a/.github/workflows/manualdeploy.yml b/.github/workflows/manualdeploy.yml index d997bf5f..f3ed1140 100644 --- a/.github/workflows/manualdeploy.yml +++ b/.github/workflows/manualdeploy.yml @@ -35,14 +35,12 @@ jobs: export NVM_DIR=~/.nvm source ~/.nvm/nvm.sh npm install - npm audit fix npm start cd ../coriolis npm install - npm audit fix npm run build - name: Deploy the code shell: bash run: | cd ../coriolis - if [ ${{ github.events.inputs.branch }} == "beta" ]; then sudo -u www-data cp -r ./build/* /var/www/beta.coriolis.io/; else sudo -u www-data cp -r ./build/* /var/www/coriolis.io/; fi + if [ ${{ github.events.inputs.branch }} == "beta" ]; then sudo rm -Rf /var/www/beta.coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/beta.coriolis.io/; else sudo rm -Rf /var/www/coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/coriolis.io/; fi