2024-07-02 00:43:30 +03:00
|
|
|
name: Build and Deploy Angular App
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
[master, 'release/*']
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Set up Node.js
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: '18'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm install
|
|
|
|
|
|
|
|
- name: Build Angular app
|
2024-07-02 00:49:26 +03:00
|
|
|
run: npm run build -- --configuration production
|
2024-07-02 00:43:30 +03:00
|
|
|
|
|
|
|
- name: Start ssh-agent
|
|
|
|
id: ssh-agent
|
|
|
|
uses: webfactory/ssh-agent@v0.9.0
|
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
|
|
|
|
- name: Deploy to Server
|
|
|
|
env:
|
|
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
|
|
TARGET_DIR: ${{ secrets.TARGET_DIR }}
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
|
2024-07-04 10:31:24 +03:00
|
|
|
sudo apt update
|
2024-07-04 10:32:43 +03:00
|
|
|
sudo apt install rsync -y
|
2024-10-25 03:06:07 +03:00
|
|
|
rsync -avr -p --chmod=770 --no-times --delete ./dist/frontend/browser/ $SSH_USER@$SSH_HOST:$TARGET_DIR
|
|
|
|
ssh $SSH_USER@$SSH_HOST "chown -R :www-data $TARGET_DIR"
|