Skip to content

Commit 231027c

Browse files
committed
gh action auto deploy setup
1 parent 7945701 commit 231027c

File tree

5 files changed

+40
-119
lines changed

5 files changed

+40
-119
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1-
name: Deploy to My Server
1+
name: Build & Deploy
2+
23
on:
34
push:
45
branches: [master]
6+
57
jobs:
68
build:
7-
name: Build
9+
name: Building Image
810
runs-on: ubuntu-latest
911
steps:
10-
- name: Deploying Poll App to the Production
12+
- uses: actions/checkout@v3
13+
- name: Login to Container Registry
14+
run: echo ${{ secrets.REGISTRY_PASSWORD }} | docker login ${{ secrets.CONTAINER_REGISTRY }} -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
15+
16+
- name: Build the latest Docker image
17+
run: docker build --tag ${{ secrets.IMAGE_NAME }} .
18+
19+
- name: Push the latest Docker image
20+
run: docker push ${{ secrets.IMAGE_NAME }}
21+
22+
deploy:
23+
name: Deploying Image
24+
runs-on: ubuntu-latest
25+
needs: [build]
26+
steps:
27+
- name: Deploying application to remote host
1128
uses: appleboy/ssh-action@master
1229
with:
13-
host: ${{ secrets.SSH_HOST }}
14-
username: ${{ secrets.SSH_USERNAME }}
15-
password: ${{ secrets.SSH_PASSWORD }}
16-
port: ${{ secrets.SSH_PORT }}
17-
script: |
18-
export NVM_DIR="$HOME/.nvm"
19-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
20-
cd poll-app
21-
git pull origin master
22-
npm install
23-
pm2 restart poll_app
30+
host: ${{ secrets.SERVER_HOST }}
31+
username: ${{ secrets.SERVER_USERNAME }}
32+
password: ${{ secrets.SERVER_PASSWORD }}
33+
script: bash sync.sh ${{ secrets.APPLICATION_NAME }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules
22
default.json
33
production.json
4-
.env
4+
.env
5+
package-lock.json
6+
.vscode

public/styles/home.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/* Just To Remove Comment */
2-
@import url("https://fonts.googleapis.com/css2?family=MuseoModerno&display=swap");
3-
@import url("https://fonts.googleapis.com/css2?family=Sriracha&display=swap");
2+
@import url('https://fonts.googleapis.com/css2?family=Sriracha&display=swap');
3+
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap');
44
.home {
55
user-select: none;
66
}
77
.home h1 {
8-
font-family: "MuseoModerno", cursive;
8+
font-family: 'Merriweather', serif;
99
color: rgb(240, 40, 40);
1010
text-shadow: 0 0 2px rgb(68, 67, 67);
1111
}
1212
.home h3 {
13-
font-family: "Sriracha", cursive;
13+
font-family: 'Sriracha', cursive;
1414
color: rgb(79, 107, 231);
1515
}
1616
@media only screen and (max-width: 600px) {

views/partials/_header.ejs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Survey Poll App</title>
7-
<script
8-
src="https://kit.fontawesome.com/57aeb32e6c.js"
9-
crossorigin="anonymous"
10-
></script>
11-
<link
12-
href="https://fonts.googleapis.com/icon?family=Material+Icons"
13-
rel="stylesheet"
14-
/>
7+
<script src="https://kit.fontawesome.com/57aeb32e6c.js" crossorigin="anonymous"></script>
8+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
159
<link
1610
rel="stylesheet"
1711
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
@@ -41,7 +35,7 @@
4135
class="brand-logo center header-title red-text"
4236
style="
4337
letter-spacing: 1px;
44-
font-family: 'MuseoModerno', cursive;
38+
font-family: 'Merriweather', serif;
4539
text-shadow: 0 0 2px rgb(68, 67, 67);
4640
"
4741
>Survey Poll App</span
@@ -68,10 +62,7 @@
6862
<ul id="slide-out" class="sidenav">
6963
<% if(typeof user === 'undefined') {%>
7064
<li>
71-
<a
72-
class="btn waves-effect waves-light red darken-2"
73-
href="/auth/google"
74-
>
65+
<a class="btn waves-effect waves-light red darken-2" href="/auth/google">
7566
<i class="fab fa-google white-text"></i>
7667
<span>Login With Google</span>
7768
</a>
@@ -94,20 +85,12 @@
9485
<% }else{ %>
9586
<li class="d-flex-start p-1-2">
9687
<div class="avatar-stamp">
97-
<img
98-
src="<%= user.avatar %>"
99-
alt=""
100-
class="circle responsive-img"
101-
/>
88+
<img src="<%= user.avatar %>" alt="" class="circle responsive-img" />
10289
</div>
103-
<p class="center flow-text ml-1">
104-
<%= user.firstName %> <%= user.lastName %>
105-
</p>
90+
<p class="center flow-text ml-1"><%= user.firstName %> <%= user.lastName %></p>
10691
</li>
10792
<li>
108-
<a href="/users/dashboard"
109-
><i class="fas fa-2x fa-user-cog"></i> Dashboard</a
110-
>
93+
<a href="/users/dashboard"><i class="fas fa-2x fa-user-cog"></i> Dashboard</a>
11194
</li>
11295
<li>
11396
<a href="/users/survey/<%= user._id %>"
@@ -116,14 +99,11 @@
11699
</li>
117100
<li>
118101
<a href="/survey/public"
119-
><i class="material-icons left" style="font-size: 2.5em">poll</i
120-
>Public Surveys</a
102+
><i class="material-icons left" style="font-size: 2.5em">poll</i>Public Surveys</a
121103
>
122104
</li>
123105
<li>
124-
<a href="/auth/logout"
125-
><i class="fas fa-2x fa-sign-out-alt"></i>Logout</a
126-
>
106+
<a href="/auth/logout"><i class="fas fa-2x fa-sign-out-alt"></i>Logout</a>
127107
</li>
128108
<% } %>
129109
</ul>

0 commit comments

Comments
 (0)