From 37603e501eb8d6ff8d93eb19d1fd877ed97414ee Mon Sep 17 00:00:00 2001 From: Kim Date: Mon, 23 Oct 2023 15:32:53 +0200 Subject: [PATCH] rsync and ssh into their own files --- .gitea/Prod-deploy.sh | 7 +++++++ .gitea/Stage-deploy.sh | 7 +++++++ .gitea/workflows/prod-deploy.yaml | 22 +++++++++------------- .gitea/workflows/stage-deploy.yaml | 8 ++------ 4 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 .gitea/Prod-deploy.sh create mode 100644 .gitea/Stage-deploy.sh diff --git a/.gitea/Prod-deploy.sh b/.gitea/Prod-deploy.sh new file mode 100644 index 000000000..f21da546f --- /dev/null +++ b/.gitea/Prod-deploy.sh @@ -0,0 +1,7 @@ +#/bin/bash + +rsync -av ${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ ubuntu@194.182.190.208:~/backend +ssh ubuntu@194.182.190.208 'sudo systemctl restart backend' +rsync -av ${{ gitea.workspace }}/typescript/frontend-marios2/* ubuntu@194.182.190.208:~/frontend/ +ssh ubuntu@194.182.190.208 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/' +ssh ubuntu@194.182.190.208 'sudo npm install -g serve' \ No newline at end of file diff --git a/.gitea/Stage-deploy.sh b/.gitea/Stage-deploy.sh new file mode 100644 index 000000000..3cb6f7b4c --- /dev/null +++ b/.gitea/Stage-deploy.sh @@ -0,0 +1,7 @@ +#/bin/bash + +rsync -av ${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ ubuntu@91.92.154.141:~/backend +ssh ubuntu@91.92.154.141 'sudo systemctl restart backend' +rsync -av ${{ gitea.workspace }}/typescript/frontend-marios2/* ubuntu@91.92.154.141:~/frontend/ +ssh ubuntu@91.92.154.141 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/' +ssh ubuntu@91.92.154.141 'sudo npm install -g serve' \ No newline at end of file diff --git a/.gitea/workflows/prod-deploy.yaml b/.gitea/workflows/prod-deploy.yaml index 1bf1d88b1..32c3adb80 100644 --- a/.gitea/workflows/prod-deploy.yaml +++ b/.gitea/workflows/prod-deploy.yaml @@ -13,19 +13,15 @@ jobs: - name: Check out repository code uses: actions/checkout@v3 - run: echo " The ${{ gitea.repository }} repository has been cloned to the runner." - - name: Build backend - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '7.0.x' + - run: dotnet publish ${{ gitea.workspace }}/csharp/App/Backend/Backend.csproj -c Release -r linux-x64 --self-contained true -p:PublishTrimmed=false + - uses: actions/setup-node@v3 - run: | - dotnet publish ${{ gitea.workspace }}/csharp/App/Backend/Backend.csproj -c Release -r linux-x64 --self-contained true -p:PublishTrimmed=false - - name: Build frontend - uses: actions/setup-node@v3 - - run: | - npm run build - - name: copy everything to Production + npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install + npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build + - name: copy everything to Prod run: | - rsync -av ${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ ubuntu@194.182.190.208:~/backend - ssh ubuntu@194.182.190.208'sudo systemctl restart backend' - rsync -rv .* ubuntu@194.182.190.208:~/frontend/ - ssh ubuntu@194.182.190.208 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/' - ssh ubuntu@194.182.190.208 'sudo npm install -g serve' + ${{ gitea.workspace }}/.gitea/Prod-deploy.sh - run: echo " This job's status is ${{ job.status }}." \ No newline at end of file diff --git a/.gitea/workflows/stage-deploy.yaml b/.gitea/workflows/stage-deploy.yaml index 06338956a..159ca3ed9 100644 --- a/.gitea/workflows/stage-deploy.yaml +++ b/.gitea/workflows/stage-deploy.yaml @@ -21,11 +21,7 @@ jobs: - run: | npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build - - name: copy everything to Stage + - name: copy everything to Stage run: | - rsync -av ${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ ubuntu@91.92.154.141:~/backend - ssh ubuntu@91.92.154.141 'sudo systemctl restart backend' - rsync -rv ${{ gitea.workspace }}/typescript/frontend-marios2/* ubuntu@91.92.154.141:~/frontend/ - ssh ubuntu@91.92.154.141 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/' - ssh ubuntu@91.92.154.141 'sudo npm install -g serve' + ${{ gitea.workspace }}/.gitea/Stage-deploy.sh - run: echo " This job's status is ${{ job.status }}." \ No newline at end of file