From daff79af189a1661bcc03128221977da147b4c05 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sat, 18 Sep 2021 22:32:02 +0200 Subject: [PATCH 1/3] [doit] add initial doit file; add task DeployToGitHubPages --- .github/workflows/Documentation.yml | 14 ++++--------- dodo.py | 32 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 dodo.py diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index e7a663220..66e4e602c 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -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: doit DeployToGitHubPages "update ${{ github.sha }}" diff --git a/dodo.py b/dodo.py new file mode 100644 index 000000000..0b988ce57 --- /dev/null +++ b/dodo.py @@ -0,0 +1,32 @@ +# doit + +from sys import executable +from os import environ +from pathlib import Path + +from doit.action import CmdAction + +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", + } From 5f9bc45c5fa58d2277b2c9fd35c558157641d79a Mon Sep 17 00:00:00 2001 From: umarcor Date: Sat, 18 Sep 2021 05:39:07 +0200 Subject: [PATCH 2/3] [doit] rename dodo.py to do.py and make it executable --- .github/workflows/Documentation.yml | 2 +- dodo.py => do.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) rename dodo.py => do.py (76%) mode change 100644 => 100755 diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 66e4e602c..4e233c969 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -97,4 +97,4 @@ jobs: run: pip install doit - name: '🚀 Deploy to GitHub-Pages' - run: doit DeployToGitHubPages "update ${{ github.sha }}" + run: ./do.py DeployToGitHubPages "update ${{ github.sha }}" diff --git a/dodo.py b/do.py old mode 100644 new mode 100755 similarity index 76% rename from dodo.py rename to do.py index 0b988ce57..43857a3fd --- a/dodo.py +++ b/do.py @@ -1,10 +1,14 @@ +#!/usr/bin/env python3 + # doit -from sys import executable +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"} @@ -30,3 +34,7 @@ def task_DeployToGitHubPages(): "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:])) From b0ea62d04325f3709b57726c2341e2e955c1ee58 Mon Sep 17 00:00:00 2001 From: umarcor Date: Wed, 7 Jul 2021 20:10:39 +0200 Subject: [PATCH 3/3] update .gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 72d3264b2..432d125dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# doit databases +/.doit.db.* + +# python +__pycache__ + # generated application files *.bin *.o