Настроил автоматическую загрузку фронтенда на сервер
All checks were successful
/ build (push) Successful in 3m52s
/ deploy (push) Successful in 47s

This commit is contained in:
Иван Кузьменко 2025-07-18 22:54:08 +03:00
parent 996aafec6c
commit d1f7493a16

View file

@ -9,7 +9,7 @@ jobs:
image: docker.io/library/node:24
steps:
- name: Install Git
run: apt update && apt install git
run: apt update && apt install -y git
- name: Checkout code
uses: actions/checkout@v4
@ -41,4 +41,30 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: website
path: build/
path: build/
deploy:
needs: [build]
runs-on: docker
steps:
- name: Install rsync
run: apt update && apt install -y rsync
- uses: actions/download-artifact@v3
with:
name: website
path: build/
- name: Add the private key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_PRIVATE_KEY }}" > ~/.ssh/id_deploy
chmod 600 ~/.ssh/id_deploy
- name: Make the known_hosts file
run: |
ssh-keyscan -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_ADDRESS }} >> ~/.ssh/known_hosts
- name: Upload folder with rsync
run: |
rsync -rvz --delete --dry-run -e "ssh -p ${{ secrets.DEPLOY_PORT }} -i ~/.ssh/id_deploy" ./build ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_ADDRESS }}:${{ secrets.DEPLOY_TARGET_FOLDER }}