Merge pull request #25 from luke-hdl/0-actions-cleanup-3 #52
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: SlapChop CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
name: "Deploy to Rhya" | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
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.PRIVATE_KEY }} | |
SSH_HOST: ${{ secrets.STAGING_SSH_HOST }} | |
- name: Stop any screens | |
run: ssh staging "screen -ls | grep '(Detached)' | awk 'sys {screen -S $1 -X quit}'" | |
- name: Check out the source | |
run: ssh staging 'cd ~/git/slapchop ; git pull' | |
- name: Start the server in a fresh screen | |
if: ${{ always() }} | |
run: ssh staging 'cd ~/git/slapchpp ; screen -dmS slapchop run_slapchop.bat' |