This repository was archived by the owner on Jun 18, 2025. It is now read-only.
Вернул всё назад #10
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 to Server | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Add server to known_hosts | |
| run: | | |
| mkdir -p ~/.ssh | |
| ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts | |
| - name: Get repository name | |
| id: repo-name | |
| run: | | |
| REPO_NAME=$(basename ${{ github.repository }}) | |
| echo "repo_name=${REPO_NAME}" >> $GITHUB_OUTPUT | |
| - name: Execute deploy script via SSH | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.SERVER_IP }} | |
| username: ${{ secrets.SERVER_USERNAME }} | |
| key: ${{ secrets.SERVER_SSH_KEY }} | |
| script: ${{ secrets.DEPLOY_SCRIPT_PATH }}/${{ steps.repo-name.outputs.repo_name }}.sh |