46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: Deploying Website
|
|
run-name: ${{ gitea.actor }} is testing out Deploying Website
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Updating apt get
|
|
run: apt update && apt upgrade -y
|
|
|
|
- name: Install rsync
|
|
run: apt install rsync -y
|
|
|
|
- name: Clone the repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install @angular/cli
|
|
run: npm install -g @angular/cli
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build Angular app
|
|
run: ng build
|
|
|
|
- name: Add host key to known_hosts
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.RUNNER_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -p ${{ secrets.SERVER_PORT }} -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
|
|
|
|
- name: Deploy to server
|
|
run: |
|
|
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} "rm -rf /var/www/todo.hstr.fr/*"
|
|
rsync -avz -e 'ssh -p ${{ secrets.SERVER_PORT }}' --delete ./dist/todo-app-angular/* ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/var/www/todo.hstr.fr
|