Skip to content

Commit

Permalink
feat: always update user's name & email
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Apr 10, 2024
1 parent 3eccb67 commit b2a9ec4
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,32 @@ module.exports = function(args) {
});
}

function setup() {
async function setNameEmail() {
const userName = args.name || args.user || args.userName || '';
const userEmail = args.email || args.userEmail || '';

userName && await git('config', 'user.name', userName);
userEmail && await git('config', 'user.email', userEmail);
}

async function setup() {
// Create a placeholder for the first commit
return fs.writeFile(pathFn.join(deployDir, 'placeholder'), '').then(() => {
return git('init');
}).then(() => {
return userName && git('config', 'user.name', userName);
}).then(() => {
return userEmail && git('config', 'user.email', userEmail);
}).then(() => {
return git('add', '-A');
}).then(() => {
return git('commit', '-m', 'First commit');
});
await fs.writeFile(pathFn.join(deployDir, 'placeholder'), '');
await git('init');
await setNameEmail();
await git('add', '-A');
await git('commit', '-m', 'First commit');
}

function push(repo) {
return git('add', '-A').then(() => {
return git('commit', '-m', message).catch(() => {
// Do nothing. It's OK if nothing to commit.
});
}).then(() => {
return git('push', '-u', repo.url, 'HEAD:' + repo.branch, '--force');
});
async function push(repo) {
await setNameEmail();
await git('add', '-A');
try {
await git('commit', '-m', message);
} catch {
// Do nothing. It's OK if nothing to commit.
}
await git('push', '-u', repo.url, 'HEAD:' + repo.branch, '--force');
}

return fs.exists(deployDir).then(exist => {
Expand Down

0 comments on commit b2a9ec4

Please sign in to comment.