Merge pull request #282 from golters/dev #116
This file contains hidden or 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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
Deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.DEPLOY_SSH_KEY }} | |
known_hosts: ${{ secrets.DEPLOY_SSH_KNOWN_HOSTS }} | |
if_key_exists: fail | |
- name: Update package list and install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y rsync | |
- name: Clear deployment cache (if any) | |
run: ssh -t ${{ secrets.DEPLOY_SSH_USER }}@${{ secrets.DEPLOY_SSH_HOST }} "rm -rf ~/deploy-cache/" | |
- name: Run deployment script | |
run: | | |
ssh -t ${{ secrets.DEPLOY_SSH_USER }}@${{ secrets.DEPLOY_SSH_HOST }} "~/deploy-mudgolt.sh" || ( | |
echo "First attempt failed, retrying..." && | |
ssh -t ${{ secrets.DEPLOY_SSH_USER }}@${{ secrets.DEPLOY_SSH_HOST }} "~/deploy-mudgolt.sh" | |
) |