Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: always update user's name & email #353

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 17 additions & 19 deletions lib/deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,30 @@ 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');
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