-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (45 loc) · 1.46 KB
/
angular_workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# .github/workflows/angular-cd.yml
name: Angular CI/CD with Digital Ocean
on:
push:
branches:
- main # Change this to the branch you want to trigger the workflow
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x' # Change this to match your project's Node.js version
- name: Install dependencies
run: npm install
- name: Build Angular app
run: npm run build
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to Digital Ocean
uses: appleboy/[email protected]
with:
host: ${{ secrets.DROPLET_IP }}
username: ${{ secrets.DROPLET_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
echo 'Creating app directory to house the app'
mkdir app
echo 'Cd into the current folder'
cd app
echo 'Clone repo from github to app directory'
git clone [email protected]:factory24/aqm-site.git
echo 'Showing current directory items'
ll -a
echo 'Building the project'
npm run build
echo 'Copy the build files to web server'
cp -f ./app/dist /var/www/html
echo 'Restart the nginx server'
sudo service nginx restart