Commit a86d9563 authored by Michael Aschauer's avatar Michael Aschauer
Browse files

workflow

parent d6f99eca
name: CI
on: [push, pull_request]
jobs:
# test:
# ...
deploy:
name: "Deploy via SSH and docker-compose"
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# needs: test
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
cat >>~/.ssh/config <<END
Host staging
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.STAGING_SSH_USER }}
SSH_KEY: ${{ secrets.STAGING_SSH_KEY }}
SSH_HOST: ${{ secrets.STAGING_SSH_HOST }}
#- name: Stop the server
# run: ssh staging 'sudo systemctl stop my-application'
- name: Check out the source
run: ssh staging 'cd /home/mash/aspace/ && git fetch && git reset --hard origin/master'
- name: Start the server
if: ${{ always() }}
run: ssh staging 'cd /home/mash/aspace/ && docker-compose up -d --build'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment