Update .forgejo/workflows/deploy.yaml
Some checks failed
Deploy to server / deploy (push) Has been cancelled

This commit is contained in:
Maksim Bengraf 2024-07-12 21:52:48 +00:00
parent 35bc5c8e95
commit 32c0719176
2 changed files with 28 additions and 6 deletions

View file

@ -1,6 +0,0 @@
on: [push]
jobs:
test:
runs-on: docker
steps:
- run: echo All Good

View file

@ -0,0 +1,28 @@
name: Deploy to server
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up SSH key
run: |
env
mkdir -p ~/.ssh
echo "${{ secrets.ARTIFACT_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -p 22 ${{ secrets.ARTIFACT_HOST }} >> ~/.ssh/known_hosts
sudo apt-get install sshpass
- name: Deploy to server
run: |
sshpass -p '${{ secrets.PSWD }}' ssh -v -o StrictHostKeyChecking=no ${{ secrets.USER }}@${{ secrets.HOST }} <<'ENDSSH'
cd ${{ secrets.APP_PATH }}
git pull
docker stop ${{ secrets.APP_NAME }}
docker system prune -f
export ${{ secrets.API_KEY_NAME }}=${{ secrets.API_KEY }}
make deploy_headless
ENDSSH