Skip to content

Instantly share code, notes, and snippets.

@kenriortega
Forked from brianmed/dotnet-core.yml
Created September 13, 2022 00:49
Show Gist options
  • Save kenriortega/fd04eb62712f991da401908cb4b9ca6f to your computer and use it in GitHub Desktop.
Save kenriortega/fd04eb62712f991da401908cb4b9ca6f to your computer and use it in GitHub Desktop.
Github Actions Pipeline for dotnet core deploying into DigitalOcean
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Install dependencies
run: dotnet restore -r linux-x64
- name: Build
run: dotnet build --configuration Release --no-restore -r linux-x64
- name: Publish
run: dotnet publish --no-build --no-restore -c Release -r linux-x64 /p:PublishSingleFile=true
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_USER }}
key: ${{ secrets.DROPLET_SSH_PRIVATE_KEY }}
script: sudo supervisorctl stop joy
- name: Place published single file onto droplet
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_USER }}
key: ${{ secrets.DROPLET_SSH_PRIVATE_KEY }}
source: "bin/Release/netcoreapp3.1/linux-x64/publish"
target: "${{ secrets.DROPLET_TARGET_DIR }}"
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_USER }}
key: ${{ secrets.DROPLET_SSH_PRIVATE_KEY }}
script: sudo supervisorctl start joy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment