forked from mhammond/pywin32
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (56 loc) · 1.92 KB
/
docs.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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@v4
- 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: 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@v3
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@v3
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