Skip to content

Deploy to Droplet

Deploy to Droplet #22

name: Deploy Angular App to Droplet
on:
push:
branches:
- main # Change to your preferred branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16.14.2 # Change to your preferred Node.js version
- name: Install Angular CLI
run: npm install -g @angular/cli
- name: Install App Dependencies
run: npm install
- name: Build Angular App
run: npm run build
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to Droplet
run: |
ssh -o StrictHostKeyChecking=no ${{secrets.DROPLET_USERNAME}}@${{secrets.DROPLET_IP}} 'rm -rf /var/www/aquametrics.net/*'
scp -o StrictHostKeyChecking=no -r dist/* ${{secrets.DROPLET_USERNAME}}@${{secrets.DROPLET_IP}}:/var/www/aquametrics.net/