-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtasks.py
40 lines (33 loc) · 1.12 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from os import environ
from os import getcwd
from os.path import join
from invoke import task
@task
def lint(c):
c.run("poetry run pre-commit run -a")
c.run("poetry run python -m mddoctest")
c.run("poetry run flake8 .")
c.run("poetry run yamllint --strict .")
c.run("npx stylelint --ignore-path .gitignore '**/*.css'")
c.run("npx eslint --ext .js --ignore-path .gitignore .")
c.run("npx remark --frail .")
c.run("npx pug-lint **/*.pug")
c.run("vale '--glob=*.md' docs")
@task
def build(c):
c.run("poetry run mkdocs build")
c.run("npx webpack")
@task
def deploy(c):
config_path = join(getcwd(), ".git", "config")
cred_path = join(getcwd(), ".git", "credentials")
with open(config_path, "a") as f:
f.write("[credential]\n")
f.write(f"helper = store --file {cred_path}\n")
with open(cred_path, "w") as f:
f.write("https://")
f.write(environ["GIT_COMMITTER_NAME"])
f.write(":")
f.write(environ["GIT_COMMITTER_PASSWORD"])
f.write("@github.com\n")
c.run("poetry run ghp-import --cname dry-python.org --branch master --push site")