Deploy to production #18
This file contains 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 production | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Install WireGuard | |
run: | | |
sudo apt update | |
sudo apt install -y wireguard openresolv | |
- name: Setup WireGuard | |
run: | | |
echo "${{ secrets.VPN_CONF }}" | base64 -d > /tmp/wg0.conf | |
sudo mv /tmp/wg0.conf /etc/wireguard/wg0.conf | |
sudo wg-quick up wg0 | |
- name: Deploy file | |
run: | | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" | base64 -d > /tmp/id_rsa | |
chmod 600 /tmp/id_rsa | |
scp -i /tmp/id_rsa -o StrictHostKeyChecking=no -r ./dist/* [email protected]:/var/www/html | |
- name: Disconnect WireGuard | |
run: sudo wg-quick down wg0 |