-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-beta.sh
More file actions
41 lines (35 loc) · 1.03 KB
/
deploy-beta.sh
File metadata and controls
41 lines (35 loc) · 1.03 KB
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
node -e "
const fs = require('fs');
const { execSync } = require('child_process');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const version = pkg.version.split('.');
version[2] = (parseInt(version[2]) + 1).toString();
pkg.version = version.join('.');
try {
const branchName = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();
const commitHash = execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).trim();
pkg.deployment = {
branch: branchName,
commitHash: commitHash
};
} catch (error) {
pkg.deployment = {
branch: 'N/A',
commitHash: 'N/A'
};
}
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
console.log('Updated version to:', pkg.version);
console.log('Branch:', pkg.deployment.branch);
console.log('Commit:', pkg.deployment.commitHash);
"
npm run build
cp -r ./dist/* ./deployment/
cd deployment
git add .
git commit -m "Deploy React app to GitHub Pages"
git push origin main
cd ..
git add .
git commit -m "Updated version"
git push origin main