From a7ed602b1a79881a126216038db9b78a932231cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kr=C5=AF=C4=8Dek?= <94629483+Pavos21@users.noreply.github.com> Date: Thu, 9 Oct 2025 09:04:18 +0200 Subject: [PATCH] Update build-and-deploy-production.yml Added VPN connection --- .../workflows/build-and-deploy-production.yml | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy-production.yml b/.github/workflows/build-and-deploy-production.yml index 86b53c1..7d71c4f 100644 --- a/.github/workflows/build-and-deploy-production.yml +++ b/.github/workflows/build-and-deploy-production.yml @@ -20,12 +20,28 @@ jobs: with: node-version: '19.8' - - name: Install dependcies + - name: Install dependencies run: npm install - name: Build project run: npm run build + # --- Connect to VPN --- + - name: Connect to VPN + run: | + echo "${{ secrets.VPN_PASSWORD }}" > vpn-pass.txt + sudo apt-get update -y + sudo apt-get install -y openconnect + sudo openconnect --user=${{ secrets.VPN_USERNAME }} \ + --passwd-on-stdin \ + ${{ secrets.VPN_URL }} < vpn-pass.txt & + sleep 10 + env: + VPN_USERNAME: ${{ secrets.VPN_USERNAME }} + VPN_PASSWORD: ${{ secrets.VPN_PASSWORD }} + VPN_URL: ${{ secrets.VPN_URL }} + + # --- Deploy via SFTP (through VPN) --- - name: SFTP uploader uses: wangyucode/sftp-upload-action@v2.0.2 with: @@ -35,3 +51,8 @@ jobs: compress: false localDir: dist/ remoteDir: www/ + + # --- Disconnect VPN --- + - name: Disconnect VPN + if: always() + run: sudo killall openconnect || true