Created
October 8, 2020 02:37
-
-
Save brianmed/d081809f8c6d012e2cdd488f43ff37bc to your computer and use it in GitHub Desktop.
Github Actions Pipeline for dotnet core deploying into DigitalOcean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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