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

refactor: Change the default branch #195

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ deploy:
- **branch**: Optional git branch to deploy the static site to.
- Defaults to `gh-pages` on GitHub.
- Defaults to `coding-pages` on Coding.net.
- Otherwise defaults to `master`.
- Otherwise defaults to `main`.
- **token**: Optional token value to authenticate with the repo. Prefix with `$` to read token from environment variable (recommended). Repo must be a http(s) url. [More details](#deploy-with-token).
- **repo_name**: Unique name when deploying to multiple repositories.
* Example:
Expand Down Expand Up @@ -94,7 +94,7 @@ deploy:
deploy:
- type: git
repo: git@github.com:<username>/<username>.github.io.git
branch: master
branch: main
- type: git
repo: git@github.com:<username>/<username>.github.io.git
branch: src
Expand Down
6 changes: 3 additions & 3 deletions lib/parse_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function parseObjRepo(repo) {

return {
url: url,
branch: branch || 'master'
branch: branch || 'main'
};
}

Expand All @@ -52,7 +52,7 @@ function parseStrRepo(repo) {

return {
url: url,
branch: branch || 'master'
branch: branch || 'main'
};

}
Expand All @@ -65,7 +65,7 @@ function testBranch(repoUrl) {
const path = match[3];

if (host === 'github.com') {
branch = rGithubPage.test(path) ? 'master' : 'gh-pages';
branch = rGithubPage.test(path) ? 'main' : 'gh-pages';
} else if (host === 'coding.net') {
branch = 'coding-pages';
}
Expand Down
2 changes: 1 addition & 1 deletion test/deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('deployer', () => {
});

function validate(branch) {
branch = branch || 'master';
branch = branch || 'main';

// Clone the remote repo
return spawn('git', ['clone', fakeRemote, validateDir, '--branch', branch]).then(() => {
Expand Down
12 changes: 6 additions & 6 deletions test/parse_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('parse config', () => {
});

result.should.eql([
{url: 'https://example.com/path/to/repo.git', branch: 'master'}
{url: 'https://example.com/path/to/repo.git', branch: 'main'}
]);
});

Expand Down Expand Up @@ -45,26 +45,26 @@ describe('parse config', () => {
});

result.should.eql([
{url: 'https://example.com/path/to/repo.git', branch: 'master'},
{url: 'https://example.com/path/to/repo.git', branch: 'main'},
{url: 'https://example.com/path/to/repo2.git', branch: 'custom'}
]);
});

it('github repo, master branch', () => {
it('github repo, main branch', () => {
// https
parseConfig({
repo: 'https://github.com/hexojs/hexojs.github.io.git'
})[0].branch.should.eql('master');
})[0].branch.should.eql('main');

// git
parseConfig({
repo: 'git://github.com/hexojs/hexojs.github.io.git'
})[0].branch.should.eql('master');
})[0].branch.should.eql('main');

// ssh
parseConfig({
repo: 'git@github.com:hexojs/hexojs.github.io.git'
})[0].branch.should.eql('master');
})[0].branch.should.eql('main');
});

it('github repo, gh-pages branch', () => {
Expand Down