Merge pull request #3 from h3ndry/fix-ci #19
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Install dotnet-format | |
run: dotnet tool install -g dotnet-format | |
- name: Check format | |
run: dotnet format | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install sshpass | |
run: sudo apt-get install sshpass | |
- name: Copy code to droplet | |
run: sshpass -v -p ${{ secrets.DROPLET_PASSWORD }} scp -o StrictHostKeyChecking=no -r * root@${{ secrets.DROPLET_IP }}:~/code/carpentry-shop | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DROPLET_IP }} | |
username: root | |
password: ${{ secrets.DROPLET_PASSWORD }} | |
script: | | |
cd ~/code/carpentry-shop | |
direnv allow | |
docker-compose down | |
docker-compose build --no-cache | |
docker-compose up -d |