Skip to content

.NET 5 project deploy #30

.NET 5 project deploy

.NET 5 project deploy #30

Workflow file for this run

name: .NET 5 project deploy
on:
workflow_dispatch: { }
workflow_run:
workflows: [ ".NET 5 project build" ]
types:
- completed
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Copy Nginx Config
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
source: "${{ vars.PROJECT_NAME }}.conf"
target: "/etc/infra/nginx.conf.d/locations"
- name: Create .env file
uses: SpicyPizza/[email protected]
with:
envkey_SVC_CONNECTION_STRING: ${{ secrets.SVC_CONNECTION_STRING }}
envkey_SVC_USER_NAME: ${{ secrets.SVC_USER_NAME }}
envkey_SVC_PASSWORD: ${{ secrets.SVC_PASSWORD }}
envkey_SVC_VECTOR: ${{ secrets.SVC_VECTOR }}
- name: Copy docker-compose and .env files
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
source: "docker-compose.yml,.env"
target: "/etc/infra/${{ vars.PROJECT_NAME }}/"
- name: Run Docker Compose
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
docker login ghcr.io -u ${{ github.repository_owner }} -p ${{ secrets.CR_PAT }}
cd /etc/infra/${{ vars.PROJECT_NAME }}
docker-compose pull && docker-compose up -d
docker exec nginx nginx -s reload