Skip to content

Commit 517e9be

Browse files
authored
Merge pull request #14 from vle-miu/master
Setup CI/CD
2 parents f26ed82 + f22e34e commit 517e9be

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

.env.prod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
REACT_APP_API_URL=http://3.149.228.186:8080/api

.github/workflows/ci-cd.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build & Deploy
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: ["20.x"]
16+
17+
steps:
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Checkout repository
24+
uses: actions/checkout@v2
25+
26+
- name: Install packages
27+
run: yarn install
28+
29+
- name: Build
30+
run: |
31+
unset CI
32+
yarn build:prod
33+
34+
- name: Upload build artifacts
35+
uses: actions/upload-artifact@v2
36+
with:
37+
name: build
38+
path: build
39+
40+
deploy:
41+
if: ${{ github.ref == 'refs/heads/master' }}
42+
needs:
43+
- build
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Download build artifacts
47+
uses: actions/download-artifact@v2
48+
with:
49+
name: build
50+
path: build
51+
52+
- name: Deploy to S3
53+
uses: jakejarvis/s3-sync-action@master
54+
with:
55+
args: --delete
56+
env:
57+
AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }}
58+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
59+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
60+
AWS_REGION: ${{ secrets.AWS_REGION }}
61+
SOURCE_DIR: "build"

package-lock.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"chart.js": "^4.4.3",
2323
"dayjs": "^1.11.12",
2424
"install": "^0.13.0",
25+
"env-cmd": "^10.1.0",
2526
"lodash": "^4.17.21",
2627
"npm": "^10.8.2",
2728
"react": "^18.3.1",
@@ -38,6 +39,7 @@
3839
"scripts": {
3940
"start": "react-scripts start",
4041
"build": "react-scripts build",
42+
"build:prod": "env-cmd -f .env.prod react-scripts build",
4143
"test": "react-scripts test",
4244
"eject": "react-scripts eject"
4345
},

0 commit comments

Comments
 (0)