diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index 7799226..7c76a0a 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -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/ \ No newline at end of file + 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 }} \ No newline at end of file