From a74622e6748a76aaf218e06c493f1ac8849b1e05 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Thu, 14 Oct 2021 23:33:12 -0400 Subject: [PATCH 1/2] Publish documentation to GitHub Pages --- .github/workflows/docs.yml | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..60a4669b51 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,71 @@ +name: docs + +on: + create: + tags: + # 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 + +jobs: + decompile: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install latest release + run: pip install --user 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: Decompile shipped help file + run: hh -decompile site ${env:USER_DIR}\PyWin32.chm + + - name: Rename root HTML file + run: mv site\PyWin32.HTML site\index.html + + # Compress first to avoid slowly uploading thousands of individual files + - name: Create archive + run: python -m zipfile -c site.zip site + + - uses: actions/upload-artifact@v2 + with: + name: documentation + path: site.zip + + publish: + runs-on: ubuntu-latest + needs: + - decompile + + # Only publish tags + if: github.event_name == 'create' && github.event.ref_type == 'tag' + + steps: + - uses: actions/download-artifact@v2 + with: + name: documentation + + - name: Unpack archive + run: python -m zipfile -e site.zip . + + - uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site + commit_message: ${{ github.event.head_commit.message }} + # Write .nojekyll at the root, see: + # https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators + enable_jekyll: false + # Only deploy if there were changes + allow_empty_commit: false From 816e51eaa794a367c52885762a3c555b6f93fab7 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Fri, 15 Oct 2021 00:14:33 -0400 Subject: [PATCH 2/2] ensure latest --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 60a4669b51..e684fe86af 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,7 @@ jobs: python-version: '3.9' - name: Install latest release - run: pip install --user pywin32 + 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')"