2023-10-23 12:16:27 +00:00
|
|
|
name: Production-Deploy
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v1.**
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Build-and-deploy-Production:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
2023-10-23 12:27:23 +00:00
|
|
|
uses: actions/checkout@v3
|
2023-10-23 12:16:27 +00:00
|
|
|
- run: echo " The ${{ gitea.repository }} repository has been cloned to the runner."
|
2023-10-23 13:32:53 +00:00
|
|
|
- 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
|
2023-10-23 12:28:13 +00:00
|
|
|
- run: |
|
2023-10-23 13:32:53 +00:00
|
|
|
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install
|
|
|
|
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build
|
2023-11-13 09:54:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
- name: stop services
|
|
|
|
uses: appleboy/ssh-action@v0.1.4
|
|
|
|
with:
|
|
|
|
host: 194.182.190.208
|
|
|
|
username: ubuntu
|
|
|
|
password: ${{ secrets.PRODUCTION_SSH_PASSPHRASE }}
|
|
|
|
script: |
|
|
|
|
sudo systemctl stop backend
|
|
|
|
|
2023-11-06 15:05:04 +00:00
|
|
|
- name: Copy Backend
|
|
|
|
uses: appleboy/scp-action@v0.1.4
|
|
|
|
with:
|
|
|
|
host: 194.182.190.208
|
|
|
|
username: ubuntu
|
|
|
|
key: ${{ secrets.PRODUCTION_SSH_KEY }}
|
2023-11-06 15:34:48 +00:00
|
|
|
source: "${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/"
|
2023-11-06 15:05:04 +00:00
|
|
|
target: "~/backend"
|
2023-11-06 15:19:24 +00:00
|
|
|
overwrite: true
|
2023-11-06 15:34:48 +00:00
|
|
|
strip_components: 1
|
2023-11-06 15:05:04 +00:00
|
|
|
|
|
|
|
- name: Copy Frontend
|
|
|
|
uses: appleboy/scp-action@v0.1.4
|
|
|
|
with:
|
|
|
|
host: 194.182.190.208
|
|
|
|
username: ubuntu
|
|
|
|
key: ${{ secrets.PRODUCTION_SSH_KEY }}
|
2023-11-06 15:34:48 +00:00
|
|
|
source: "${{ gitea.workspace }}/typescript/frontend-marios2/"
|
2023-11-06 15:05:04 +00:00
|
|
|
target: "~/frontend"
|
2023-11-06 15:19:24 +00:00
|
|
|
overwrite: true
|
2023-11-06 15:34:48 +00:00
|
|
|
strip_components: 1
|
2023-11-06 15:05:04 +00:00
|
|
|
|
|
|
|
- name: restart services
|
|
|
|
uses: appleboy/ssh-action@v0.1.4
|
|
|
|
with:
|
|
|
|
host: 194.182.190.208
|
|
|
|
username: ubuntu
|
|
|
|
password: ${{ secrets.PRODUCTION_SSH_PASSPHRASE }}
|
|
|
|
script: |
|
|
|
|
sudo systemctl restart backend
|
2023-11-06 15:24:11 +00:00
|
|
|
sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/
|
2023-11-06 15:05:04 +00:00
|
|
|
sudo npm install -g serve
|