-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (39 loc) · 1.22 KB
/
node.js.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
name: Node.js CI/CD with Docker
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Instal l dependencies
run: npm install
- name: Test
run: npm test
- name: Build Docker image
run: docker build -t pedropaino/medfinancemanager:${{ github.sha }} .
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image to Docker Hub
run: docker push pedropaino/medfinancemanager:${{ github.sha }}
- name: Deploy to AWS (optional)
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Grant execute permission for deploy script
run: chmod +x ./deploy-script.sh
- name: Execute deployment script
run: ./deploy-script.sh
if: success()