Innovenergy_trunk/.gitea/workflows/prod-deploy.yaml

64 lines
2.1 KiB
YAML

name: Production-Deploy
on:
push:
tags:
- v1.**
jobs:
Build-and-deploy-Production:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- run: echo " The ${{ gitea.repository }} repository has been cloned to the runner."
- 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: |
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build
- 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
- name: Copy Backend
uses: appleboy/scp-action@v0.1.4
with:
host: 194.182.190.208
username: ubuntu
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: "${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/"
target: "~/backend"
overwrite: true
strip_components: 1
- name: Copy Frontend
uses: appleboy/scp-action@v0.1.4
with:
host: 194.182.190.208
username: ubuntu
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: "${{ gitea.workspace }}/typescript/frontend-marios2/"
target: "~/frontend"
overwrite: true
strip_components: 1
- 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
sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/
sudo npm install -g serve