From 6ee1a17f61f80a025690881d00d83e63020ace2c Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 6 Oct 2024 13:18:19 -0400 Subject: [PATCH] Fix publishing documentation --- .github/workflows/docs.yml | 32 +++++++++++++++++--------------- AutoDuck/{README => README.md} | 2 +- AutoDuck/common_top.mak | 17 ++++++++--------- AutoDuck/make.py | 4 +++- 4 files changed, 29 insertions(+), 26 deletions(-) rename AutoDuck/{README => README.md} (77%) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index edeb8e0663..0bc13597ba 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,15 +3,22 @@ name: docs on: create: tags: - # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - b[0-9][0-9][0-9] - publish-docs* push: branches: - main + pull_request: + branches: + - main + paths: + - 'AutoDuck/**' + - '**/.html' + - .github/workflows/docs.yml jobs: - decompile: + generate: runs-on: windows-latest steps: @@ -19,17 +26,12 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 - with: - python-version: '3.9' - - - name: Install latest release - run: pip install --user --upgrade pywin32 - - name: Set Python user site directory - run: python -c "import os,site;open(os.environ['GITHUB_ENV'], 'a').write(f'USER_DIR={site.USER_SITE}\n')" + - name: Generate help file + run: python AutoDuck/make.py - - name: Decompile shipped help file - run: hh -decompile site ${env:USER_DIR}\PyWin32.chm + - name: Decompile help file + run: hh -decompile site PyWin32.chm - name: Rename root HTML file run: mv site\PyWin32.HTML site\index.html @@ -38,7 +40,7 @@ jobs: - name: Create archive run: python -m zipfile -c site.zip site - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: documentation path: site.zip @@ -46,20 +48,20 @@ jobs: publish: runs-on: ubuntu-latest needs: - - decompile + - generate # Only publish tags if: github.event_name == 'create' && github.event.ref_type == 'tag' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: documentation - name: Unpack archive run: python -m zipfile -e site.zip . - - uses: peaceiris/actions-gh-pages@v3 + - uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site diff --git a/AutoDuck/README b/AutoDuck/README.md similarity index 77% rename from AutoDuck/README rename to AutoDuck/README.md index 5d0520aed2..192828d796 100644 --- a/AutoDuck/README +++ b/AutoDuck/README.md @@ -1,4 +1,4 @@ -Just run MAKE.BAT to build the documentation. +Just run [make.py](./make.py) to build the documentation. Main focus these days is on the .chm file - a single .chm provides the best documentation solution. We don't even diff --git a/AutoDuck/common_top.mak b/AutoDuck/common_top.mak index a76ffcda96..a2ebbd9e00 100644 --- a/AutoDuck/common_top.mak +++ b/AutoDuck/common_top.mak @@ -1,13 +1,12 @@ # Common AutoDuck make file -AD = bin\autoduck.exe /Spythonwin.fmt +AD = bin\autoduck.exe /Spythonwin.fmt ADHTMLFMT = bin\autoduck.exe /Spyhtml.fmt ADHTMLLOG = /R html "/L$(GENDIR)\$(TARGET).HHLOG" /N -ADLOG = /R help "/L$(GENDIR)\$(TARGET).HLOG" /N -ADHTML = /R html "/G$(GENDIR)\$(TARGET).DUMP" "/C$(GENDIR)\$(TARGET).HHLOG" "/I$(GENDIR)\$(TARGET).IDX" "/O$(GENDIR)\$(TARGET).HTML" /D "title=$(TITLE)" -ADHLP = /R help "/C$(GENDIR)\$(TARGET).HLOG" "/O$(GENDIR)\$(TARGET).RTF" /D "title=$(TITLE)" -ADDOC = /RD "/O$(GENDIR)\$(TARGET).DOC" /D "doc_header=$(DOCHDR)" -ADTAB = 8 -HC = hcw /a /c /e -HHC = hhc -PYTHON = py -2.7 +ADLOG = /R help "/L$(GENDIR)\$(TARGET).HLOG" /N +ADHTML = /R html "/G$(GENDIR)\$(TARGET).DUMP" "/C$(GENDIR)\$(TARGET).HHLOG" "/I$(GENDIR)\$(TARGET).IDX" "/O$(GENDIR)\$(TARGET).HTML" /D "title=$(TITLE)" +ADHLP = /R help "/C$(GENDIR)\$(TARGET).HLOG" "/O$(GENDIR)\$(TARGET).RTF" /D "title=$(TITLE)" +ADDOC = /RD "/O$(GENDIR)\$(TARGET).DOC" /D "doc_header=$(DOCHDR)" +ADTAB = 8 +HC = hcw /a /c /e +HHC = hhc diff --git a/AutoDuck/make.py b/AutoDuck/make.py index d3b9ee39a3..c205aa0da8 100644 --- a/AutoDuck/make.py +++ b/AutoDuck/make.py @@ -26,5 +26,7 @@ ).splitlines()[-1] subprocess.run( - [nmake, "-E", "-f", "pywin32.mak"], cwd=os.path.dirname(sys.argv[0]), check=True + [nmake, f'PYTHON="{sys.executable}"', "-E", "-f", "pywin32.mak"], + cwd=os.path.dirname(sys.argv[0]), + check=True, )