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

64 lines
2.5 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@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- run: echo " The ${{ gitea.repository }} repository has been cloned to the runner."
- uses: actions/setup-dotnet@55ec9447dda3d1cf6bd587150f3262f30ee10815 # 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@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
- run: npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 audit --audit-level=moderate || true
- run: |
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install --ignore-scripts
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build
- name: stop services
uses: appleboy/ssh-action@1d1b21ca96111b1eb4c03c21c14ebb971d2200f6 # 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@8a92fcdb1eb4ffbf538b2fa286739760aac8a95b # 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@8a92fcdb1eb4ffbf538b2fa286739760aac8a95b # 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@1d1b21ca96111b1eb4c03c21c14ebb971d2200f6 # 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/