Skip to content

Commit 62522ce

Browse files
build: publish docs (#354)
1 parent 2a73ff4 commit 62522ce

4 files changed

Lines changed: 49 additions & 23 deletions

File tree

.github/workflows/doc.yml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ name: Gen Docs
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches:
7-
- main
8-
paths:
9-
- 'TermTk/**'
10-
- 'docs/**'
11-
- 'tests/**'
12-
- 'tutorial/**'
5+
workflow_call:
6+
# push:
7+
# branches:
8+
# - main
9+
# paths:
10+
# - 'TermTk/**'
11+
# - 'docs/**'
12+
# - 'tests/**'
13+
# - 'tutorial/**'
14+
# release:
15+
# types:
16+
# - created # Trigger the workflow when a release is created
1317

1418
permissions:
1519
contents: write
@@ -25,18 +29,29 @@ jobs:
2529
- uses: actions/checkout@v4
2630
with:
2731
ref: ${{ github.sha }}
28-
- name: Set up Git
29-
shell: bash
32+
- name: Gen Docs
3033
run: |
31-
git config --global user.name 'Eugenio Parodi - Action'
32-
git config --global user.email 'ceccopierangioliegenio@googlemail.com'
34+
echo "Generating Docs"
35+
make doc
3336
- name: clone pyTermTk-docs
3437
env:
3538
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
3639
run: |
40+
git config --global user.name 'Eugenio Parodi - Action'
41+
git config --global user.email 'ceccopierangioliegenio@googlemail.com'
3742
git clone https://${GITHUB_TOKEN}@github.com/ceccopierangiolieugenio/pyTermTk-Docs.git
3843
cd pyTermTk-Docs
39-
echo "Test - $(date)" > test.txt
40-
git add .
41-
git commit -m "chore: added file - ($(date))"
42-
git push
44+
git fetch --all
45+
git checkout docs
46+
cp -a \
47+
../docs/source/_build/html/* \
48+
../docs/source/_build/html/.buildinfo \
49+
../docs/source/_build/html/.nojekyll \
50+
.
51+
git add --all
52+
git commit -m "chore: updated docs - ($(date))"
53+
git push --force origin docs
54+
git checkout gh-pages
55+
git reset --hard initial-commit
56+
git merge docs
57+
git push --force origin gh-pages

.github/workflows/release.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,10 @@ jobs:
6969
git commit -m "chore: updated version to ${_VERSION}"
7070
git push
7171
72-
73-
pyTermTk_deploy:
72+
pyTermTk-deploy-artifacts:
73+
if: ${{ fromJson(needs.release-please.outputs.rp_out)['TermTk--release_created'] }}
7474
runs-on: ubuntu-latest
7575
name: Deploy pyTermTk to github release
76-
if: ${{ fromJson(needs.release-please.outputs.rp_out)['TermTk--release_created'] }}
7776
needs: release-please
7877
steps:
7978
- uses: actions/checkout@v4
@@ -108,3 +107,10 @@ jobs:
108107
gh release upload ${TAG_NAME} tmp/tutorial.tgz
109108
gh release upload ${TAG_NAME} tmp/tests.tgz
110109
gh release upload ${TAG_NAME} tmp/demo.tgz
110+
111+
pyTermTk-deploy-docs:
112+
if: ${{ fromJson(needs.release-please.outputs.rp_out)['TermTk--release_created'] }}
113+
runs-on: ubuntu-latest
114+
name: Deploy pyTermTk Docs
115+
uses: ./.github/workflows/doc.yml
116+
needs: release-please

TermTk/TTkCore/drivers/term_unix.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ class TTkTerm(TTkTermBase):
3838

3939
# Save treminal attributes during the initialization in order to
4040
# restore later the original states
41-
_termAttr = termios.tcgetattr(sys.stdin)
41+
42+
if os.isatty(sys.stdin.fileno()):
43+
_termAttr = termios.tcgetattr(sys.stdin)
44+
else:
45+
_termAttr = None
4246

4347
_termAttrBk = []
4448
@staticmethod
@@ -49,7 +53,7 @@ def saveTermAttr():
4953
def restoreTermAttr():
5054
if TTkTerm._termAttrBk:
5155
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, TTkTerm._termAttrBk.pop())
52-
else:
56+
elif TTkTerm._termAttr:
5357
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, TTkTerm._termAttr)
5458

5559
@staticmethod
@@ -79,7 +83,8 @@ def getSigmask():
7983
@staticmethod
8084
def exit():
8185
TTkTermBase.exit()
82-
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, TTkTerm._termAttr)
86+
if TTkTerm._termAttr:
87+
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, TTkTerm._termAttr)
8388

8489
@staticmethod
8590
def _push(*args):

TermTk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version:str = "0.41.8-a.0"
1+
version:str = "0.41.8-a.1"
22

33
from .TTkCore import *
44
from .TTkTheme import *

0 commit comments

Comments
 (0)