Skip to content

Commit c167e1b

Browse files
chore: add script to make changes for production
Added a nodejs script to change homepage for production. Also modified github workflows to run this script.
1 parent ae79403 commit c167e1b

2 files changed

Lines changed: 28 additions & 23 deletions

File tree

.github/workflows/frontend_deploy.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,33 @@ name: Continuous Deployment
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
deploy:
9-
109
runs-on: ubuntu-latest
1110

1211
strategy:
1312
matrix:
1413
node-version: [16.x]
1514

1615
steps:
17-
- uses: actions/checkout@v3
18-
- name: Use Node.js ${{ matrix.node-version }}
19-
uses: actions/setup-node@v3
20-
with:
21-
node-version: ${{ matrix.node-version }}
22-
cache: 'npm'
23-
- name: Cache
24-
uses: actions/cache@v3.0.2
25-
with:
26-
path: frontend/node_modules
27-
key: ${{ runner.os }}-${{ hashFiles('frontend/package-lock.json') }}
28-
- run: cd frontend && npm ci && npm run build
29-
- name: FTP Deploy
30-
uses: SamKirkland/FTP-Deploy-Action@4.3.0
31-
with:
32-
server: ${{ secrets.ftp_server }}
33-
username: ${{ secrets.ftp_username }}
34-
password: ${{ secrets.ftp_password }}
35-
36-
37-
16+
- uses: actions/checkout@v3
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
cache: "npm"
22+
- name: Cache
23+
uses: actions/cache@v3.0.2
24+
with:
25+
path: frontend/node_modules
26+
key: ${{ runner.os }}-${{ hashFiles('frontend/package-lock.json') }}
27+
- run: node frontend/tools/prod_change.js
28+
- run: cd frontend && npm ci && npm run build
29+
- name: FTP Deploy
30+
uses: SamKirkland/FTP-Deploy-Action@4.3.0
31+
with:
32+
server: ${{ secrets.ftp_server }}
33+
username: ${{ secrets.ftp_username }}
34+
password: ${{ secrets.ftp_password }}

frontend/tools/prod_change.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// eslint-disable-next-line @typescript-eslint/no-var-requires
2+
const fs = require("fs");
3+
4+
const path = __dirname + "/../package.json";
5+
let rawdata = fs.readFileSync(path);
6+
let data = JSON.parse(rawdata);
7+
data.homepage = "https://iiitdmj.ac.in/webix.iiitdmj.ac.in/";
8+
fs.writeFileSync(path, JSON.stringify(data));

0 commit comments

Comments
 (0)