File tree 6 files changed +181
-0
lines changed
6 files changed +181
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : CI Pipeline
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ pull_request :
7
+ branches : [ main ]
8
+
9
+ jobs :
10
+ ubuntu-build :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ - name : Checkout repository
15
+ uses : actions/checkout@v3
16
+
17
+ - name : Set up Node.js
18
+ uses : actions/setup-node@v3
19
+ with :
20
+ node-version : ' 20.x'
21
+
22
+ - name : Install dependencies
23
+ run : npm install
24
+
25
+ - name : Run tests
26
+ run : npm test
27
+
28
+ windows-build :
29
+ runs-on : windows-latest
30
+
31
+ steps :
32
+ - name : Checkout repository
33
+ uses : actions/checkout@v3
34
+
35
+ - name : Set up Node.js
36
+ uses : actions/setup-node@v3
37
+ with :
38
+ node-version : ' 20.x'
39
+
40
+ - name : Install dependencies
41
+ run : npm install
42
+
43
+ - name : Run tests
44
+ run : npm test
45
+
46
+ macos-build :
47
+ runs-on : macos-latest
48
+
49
+ steps :
50
+ - name : Checkout repository
51
+ uses : actions/checkout@v3
52
+
53
+ - name : Set up Node.js
54
+ uses : actions/setup-node@v3
55
+ with :
56
+ node-version : ' 20.x'
57
+
58
+ - name : Install dependencies
59
+ run : npm install
60
+
61
+ - name : Run tests
62
+ run : npm test
Original file line number Diff line number Diff line change
1
+ name : Deploy to Docker
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - OzPol*
8
+ - dev*
9
+ workflow_dispatch :
10
+
11
+ jobs :
12
+ deploy-to-docker :
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Checkout repository
17
+ uses : actions/checkout@v3
18
+
19
+ - name : Set up Docker Buildx
20
+ uses : docker/setup-buildx-action@v2
21
+
22
+ - name : Login to DockerHub
23
+ uses : docker/login-action@v2
24
+ with :
25
+ username : ${{ secrets.DOCKER_USERNAME }}
26
+ password : ${{ secrets.DOCKER_PASSWORD }}
27
+
28
+ - name : Build and push Docker image
29
+ uses : docker/build-push-action@v4
30
+ with :
31
+ context : .
32
+ push : true
33
+ tags : ${{ secrets.DOCKER_USERNAME }}/probooker:latest
34
+
Original file line number Diff line number Diff line change
1
+ name : Deploy to Heroku
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - OzPol* # Deploy any branch starting with 'OzPol'
8
+ workflow_dispatch :
9
+
10
+ jobs :
11
+ deploy-to-heroku :
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+ - name : Checkout repository
16
+ uses : actions/checkout@v3
17
+ with :
18
+ fetch-depth : 0 # Unshallow the repository
19
+
20
+ - name : Set up Node.js
21
+ uses : actions/setup-node@v3
22
+ with :
23
+ node-version : ' 20.x'
24
+
25
+ - name : Install dependencies
26
+ run : npm install
27
+
28
+ - name : Install Heroku CLI
29
+ run : curl https://cli-assets.heroku.com/install.sh | sh
30
+
31
+ - name : Deploy to Heroku
32
+ env :
33
+ HEROKU_API_KEY : ${{ secrets.HEROKU_API_KEY }}
34
+ run : |
35
+ echo $HEROKU_API_KEY | heroku auth:token
36
+ heroku git:remote -a probooker-app
37
+ git push https://heroku:${{ secrets.HEROKU_API_KEY }}@git.heroku.com/probooker-app.git HEAD:main
38
+
Original file line number Diff line number Diff line change
1
+ # Use the official Node.js image.
2
+ FROM node:14
3
+
4
+ # Create and change to the app directory.
5
+ WORKDIR /usr/src/app
6
+
7
+ # Copy application dependency manifests to the container image.
8
+ COPY package*.json ./
9
+
10
+ # Install production dependencies.
11
+ RUN npm install --only=production
12
+
13
+ # Copy local code to the container image.
14
+ COPY . .
15
+
16
+ # Run the web service on container startup.
17
+ CMD [ "npm" , "start" ]
18
+
19
+ # Inform Docker that the container listens on the specified network ports at runtime.
20
+ EXPOSE 3000
Original file line number Diff line number Diff line change
1
+ const express = require ( 'express' ) ;
2
+ const app = express ( ) ;
3
+ const port = process . env . PORT || 3000 ;
4
+
5
+ app . get ( '/' , ( req , res ) => {
6
+ res . send ( 'ProBooker' ) ;
7
+ } ) ;
8
+
9
+ app . listen ( port , ( ) => {
10
+ console . log ( `Server is running on port ${ port } ` ) ;
11
+ } ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " probooker" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " A dynamic booking system connecting customers with local service providers seamlessly." ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "start" : " node index.js" ,
8
+ "test" : " echo \" No tests specified\" "
9
+ },
10
+ "dependencies" : {
11
+ "express" : " ^4.19.2"
12
+ },
13
+ "engines" : {
14
+ "node" : " 20.x"
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments