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

Switch the default branch to "main" #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Sources/Publish/API/DeploymentMethod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public struct DeploymentMethod<Site: Website> {
public extension DeploymentMethod {
/// Deploy a website to a given remote using Git.
/// - parameter remote: The full address of the remote to deploy to.
/// - parameter branch: The branch to push to and pull from (default is master).
static func git(_ remote: String, branch: String = "master") -> Self {
/// - parameter branch: The branch to push to and pull from (default is main).
static func git(_ remote: String, branch: String = "main") -> Self {
DeploymentMethod(name: "Git (\(remote))") { context in
let folder = try context.createDeploymentFolder(withPrefix: "Git") { folder in
if !folder.containsSubfolder(named: ".git") {
Expand Down Expand Up @@ -93,9 +93,9 @@ public extension DeploymentMethod {

/// Deploy a website to a given GitHub repository.
/// - parameter repository: The full name of the repository (including its username).
/// - parameter branch: The branch to push to and pull from (default is master).
/// - parameter branch: The branch to push to and pull from (default is main).
/// - parameter useSSH: Whether an SSH connection should be used (preferred).
static func gitHub(_ repository: String, branch: String = "master", useSSH: Bool = true) -> Self {
static func gitHub(_ repository: String, branch: String = "main", useSSH: Bool = true) -> Self {
let prefix = useSSH ? "[email protected]:" : "https://github.com/"
return git("\(prefix)\(repository).git", branch: branch)
}
Expand Down
10 changes: 5 additions & 5 deletions Tests/PublishTests/Tests/DeploymentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ final class DeploymentTests: PublishTestCase {

try shellOut(to: [
"git init",
// Not all git installations init with a master branch.
"git checkout master || git checkout -b master",
// Not all git installations init with a main branch.
"git checkout main || git checkout -b main",
"git config --local receive.denyCurrentBranch updateInstead"
], at: remote.path)

Expand Down Expand Up @@ -91,12 +91,12 @@ final class DeploymentTests: PublishTestCase {
try shellOut(
to: [
"git init",
// Not all git installations init with a master branch.
"git checkout master || git checkout -b master"
// Not all git installations init with a main branch.
"git checkout main || git checkout -b main"
],
at: remote.path
)

// First generate
try publishWebsite(in: repo, using: [
.generateHTML(withTheme: .foundation)
Expand Down