-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from umarcor/doit-pages
[doit] add initial doit file; add task DeployToGitHubPages
- Loading branch information
Showing
3 changed files
with
50 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# doit databases | ||
/.doit.db.* | ||
|
||
# python | ||
__pycache__ | ||
|
||
# generated application files | ||
*.bin | ||
*.o | ||
|
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# doit | ||
|
||
from sys import executable, argv as sys_argv, exit as sys_exit | ||
from os import environ | ||
from pathlib import Path | ||
|
||
from doit.action import CmdAction | ||
from doit.cmd_base import ModuleTaskLoader | ||
from doit.doit_cmd import DoitMain | ||
|
||
DOIT_CONFIG = {"verbosity": 2, "action_string_formatting": "both"} | ||
|
||
ROOT = Path(__file__).parent | ||
|
||
|
||
def task_DeployToGitHubPages(): | ||
cwd = str(ROOT / "public") | ||
return { | ||
"actions": [ | ||
CmdAction(cmd, cwd=cwd) | ||
for cmd in [ | ||
"git init", | ||
"cp ../.git/config ./.git/config", | ||
"touch .nojekyll", | ||
"git add .", | ||
'git config --local user.email "push@gha"', | ||
'git config --local user.name "GHA"', | ||
"git commit -am '{posargs}'", | ||
"git push -u origin +HEAD:gh-pages", | ||
] | ||
], | ||
"doc": "Create a clean branch in subdir 'public' and push to branch 'gh-pages'", | ||
"pos_arg": "posargs", | ||
} | ||
|
||
|
||
if __name__ == '__main__': | ||
sys_exit(DoitMain(ModuleTaskLoader(globals())).run(sys_argv[1:])) |