Skip to content

Try again

Try again #8

Workflow file for this run

name: deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa # optional
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
- name: rsync over ssh
run: rsync -avz ${{ github.workspace }} ${{ secrets.SSH_USER }}@${{ secrets.HOST }}:/root/
- name: Restart containers
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
cd root
docker stop ${{ vars.DOCKER_IMAGE_NAME }} 2> /dev/null || true
docker build -f .\${{ github.event.repository.name }}\${{ github.event.repository.name }}\Dockerfile -t ${{ vars.DOCKER_IMAGE_NAME }} .\${{ github.event.repository.name }}\
docker run --name ${{ vars.DOCKER_IMAGE_NAME }} -v \root\${{ github.event.repository.name }}\${{ github.event.repository.name }}\wwwroot\:\app\wwwroot\ -p 5374:80 ${{ vars.DOCKER_IMAGE_NAME }}