Skip to content

Commit

Permalink
Merge pull request #162 from umarcor/doit-pages
Browse files Browse the repository at this point in the history
[doit] add initial doit file; add task DeployToGitHubPages
  • Loading branch information
stnolting authored Sep 18, 2021
2 parents b542c38 + b0ea62d commit e5952d5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,8 @@ jobs:
NEORV32-SITE-nightly.tar.gz
pdf/NEORV32*nightly.pdf
- name: '🐍 Install doit'
run: pip install doit

- name: '🚀 Deploy to GitHub-Pages'
run: |
cd public
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 "update ${{ github.sha }}"
git push -u origin +HEAD:gh-pages
run: ./do.py DeployToGitHubPages "update ${{ github.sha }}"
6 changes: 6 additions & 0 deletions .gitignore
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
Expand Down
40 changes: 40 additions & 0 deletions do.py
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:]))

0 comments on commit e5952d5

Please sign in to comment.