-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
140 changed files
with
1,449 additions
and
1,442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import Utils.*; | ||
|
||
class Config { | ||
static public var htmlDir = env("GHP_HTMLDIR", "bin/api"); | ||
static public var remote = env("GHP_REMOTE", null); // should be in the form of https://[email protected]/account/repo.git | ||
static public var branch = env("GHP_BRANCH", "gh-pages"); | ||
static public var username = env("GHP_USERNAME", null); | ||
static public var email = env("GHP_EMAIL", null); | ||
} | ||
static public var htmlDir = env("GHP_HTMLDIR", "bin/api"); | ||
static public var remote = env("GHP_REMOTE", null); // should be in the form of https://[email protected]/account/repo.git | ||
static public var branch = env("GHP_BRANCH", "gh-pages"); | ||
static public var username = env("GHP_USERNAME", null); | ||
static public var email = env("GHP_EMAIL", null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
import Sys.*; | ||
import Utils.*; | ||
import Config.*; | ||
|
||
using StringTools; | ||
|
||
class DeployGhPages { | ||
static function main():Void { | ||
var root = getCwd(); | ||
static function main():Void { | ||
var root = getCwd(); | ||
|
||
if (remote == null) { | ||
println('GHP_REMOTE is not set, skip deploy.'); | ||
return; | ||
} | ||
if (remote == null) { | ||
println('GHP_REMOTE is not set, skip deploy.'); | ||
return; | ||
} | ||
|
||
// TravisCI by default clones repositories to a depth of 50 commits. | ||
// We need a full clone inorder to do git operations. | ||
runCommand("git", ["fetch", "--unshallow"]); | ||
// TravisCI by default clones repositories to a depth of 50 commits. | ||
// We need a full clone inorder to do git operations. | ||
runCommand("git", ["fetch", "--unshallow"]); | ||
|
||
var sha = commandOutput("git", ["rev-parse", "HEAD"]).trim(); | ||
var sha = commandOutput("git", ["rev-parse", "HEAD"]).trim(); | ||
|
||
setCwd(htmlDir); | ||
runCommand("git", ["init"]); | ||
if (username != null) | ||
runCommand("git", ["config", "--local", "user.name", username]); | ||
if (email != null) | ||
runCommand("git", ["config", "--local", "user.email", email]); | ||
runCommand("git", ["remote", "add", "local", root]); | ||
runCommand("git", ["remote", "add", "remote", remote]); | ||
runCommand("git", ["fetch", "--all"]); | ||
runCommand("git", ["checkout", "--orphan", branch]); | ||
if (commandOutput("git", ["ls-remote", "--heads", "local", branch]).trim() != "") { | ||
runCommand("git", ["reset", "--soft", 'local/${branch}']); | ||
} | ||
if (commandOutput("git", ["ls-remote", "--heads", "remote", branch]).trim() != "") { | ||
runCommand("git", ["reset", "--soft", 'remote/${branch}']); | ||
} | ||
runCommand("git", ["add", "--all"]); | ||
runCommand("git", ["commit", "--allow-empty", "--quiet", "-m", 'deploy for ${sha}']); | ||
runCommand("git", ["push", "local", branch]); | ||
setCwd(htmlDir); | ||
runCommand("git", ["init"]); | ||
if (username != null) | ||
runCommand("git", ["config", "--local", "user.name", username]); | ||
if (email != null) | ||
runCommand("git", ["config", "--local", "user.email", email]); | ||
runCommand("git", ["remote", "add", "local", root]); | ||
runCommand("git", ["remote", "add", "remote", remote]); | ||
runCommand("git", ["fetch", "--all"]); | ||
runCommand("git", ["checkout", "--orphan", branch]); | ||
if (commandOutput("git", ["ls-remote", "--heads", "local", branch]).trim() != "") { | ||
runCommand("git", ["reset", "--soft", 'local/${branch}']); | ||
} | ||
if (commandOutput("git", ["ls-remote", "--heads", "remote", branch]).trim() != "") { | ||
runCommand("git", ["reset", "--soft", 'remote/${branch}']); | ||
} | ||
runCommand("git", ["add", "--all"]); | ||
runCommand("git", ["commit", "--allow-empty", "--quiet", "-m", 'deploy for ${sha}']); | ||
runCommand("git", ["push", "local", branch]); | ||
|
||
setCwd(root); | ||
runCommand("git", ["push", remote, branch]); | ||
} | ||
} | ||
setCwd(root); | ||
runCommand("git", ["push", remote, branch]); | ||
} | ||
} |
Oops, something went wrong.