Added deploy.yml
This commit is contained in:
48
.github/deploy.yml
vendored
Normal file
48
.github/deploy.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: Build & Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '10.0.x'
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore src/
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build src/ --configuration Release --no-restore
|
||||||
|
|
||||||
|
- name: Publish
|
||||||
|
run: dotnet publish src/ -c Release -o publish
|
||||||
|
|
||||||
|
- name: Copy files to server
|
||||||
|
uses: appleboy/scp-action@v0.1.7
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEPLOY_HOST }}
|
||||||
|
username: ${{ secrets.DEPLOY_USER }}
|
||||||
|
key: ${{ secrets.LD50_DEV_DEPLOY_SSH_KEY }}
|
||||||
|
port: 6922
|
||||||
|
source: "publish/*"
|
||||||
|
target: "/var/www/QuotesTest"
|
||||||
|
strip_components: 1
|
||||||
|
|
||||||
|
- name: Restart app
|
||||||
|
uses: appleboy/ssh-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEPLOY_HOST }}
|
||||||
|
username: ${{ secrets.DEPLOY_USER }}
|
||||||
|
key: ${{ secrets.LD50_DEV_DEPLOY_SSH_KEY }}
|
||||||
|
port: 6922
|
||||||
|
script: |
|
||||||
|
sudo systemctl restart QuotesTest.service
|
||||||
Reference in New Issue
Block a user