@@ -17,29 +17,49 @@ jobs:
17
17
run : |
18
18
git config --global user.name 'travis-ci'
19
19
git config --global user.email 'travis@nowhere.edu'
20
+ - name : Filter changed file paths to outputs
21
+ uses : dorny/paths-filter@v2.7.0
22
+ id : changes
23
+ with :
24
+ filters : |
25
+ root_docs:
26
+ - CHANGES
27
+ - README.*
28
+ docs:
29
+ - 'docs/**/*.rst'
30
+ - 'docs/**/*.md'
31
+ python_files:
32
+ - 'tmuxp/**'
33
+ - name : Should publish
34
+ if : steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true'
35
+ run : echo "PUBLISH=$(echo true)" >> $GITHUB_ENV
20
36
- name : Set up Python ${{ matrix.python-version }}
21
37
uses : actions/setup-python@v1
22
38
with :
23
39
python-version : ${{ matrix.python-version }}
24
40
25
41
- name : Get full Python version
26
42
id : full-python-version
43
+ if : env.PUBLISH == 'true'
27
44
shell : bash
28
45
run : echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
29
46
30
47
- name : Install poetry
48
+ if : env.PUBLISH == 'true'
31
49
run : |
32
50
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
33
51
python get-poetry.py -y --version 1.0.10
34
52
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
35
53
rm get-poetry.py
36
54
37
55
- name : Get poetry cache paths from config
56
+ if : env.PUBLISH == 'true'
38
57
run : |
39
58
echo "poetry_cache_dir=$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
40
59
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
41
60
42
61
- name : Configure poetry
62
+ if : env.PUBLISH == 'true'
43
63
shell : bash
44
64
run : poetry config virtualenvs.in-project true
45
65
@@ -54,22 +74,26 @@ jobs:
54
74
key : venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
55
75
56
76
- name : Ensure cache is healthy
57
- if : steps.cache.outputs.cache-hit == 'true'
77
+ if : steps.cache.outputs.cache-hit == 'true' && env.PUBLISH == 'true'
58
78
shell : bash
59
79
run : poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
60
80
61
81
- name : Upgrade pip
62
82
shell : bash
83
+ if : env.PUBLISH == 'true'
63
84
run : poetry run python -m pip install pip -U
64
85
65
86
- name : Install dependencies [w/ docs]
87
+ if : env.PUBLISH == 'true'
66
88
run : poetry install --extras "docs lint"
67
89
68
90
- name : Build documentation
91
+ if : env.PUBLISH == 'true'
69
92
run : |
70
93
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
71
94
72
95
- name : Push documentation to S3
96
+ if : env.PUBLISH == 'true'
73
97
uses : jakejarvis/s3-sync-action@master
74
98
with :
75
99
args : --acl public-read --follow-symlinks --delete
81
105
SOURCE_DIR : ' docs/_build/html' # optional: defaults to entire repository
82
106
83
107
- name : Generate list of changed files for CloudFront to invalidate
108
+ if : env.PUBLISH == 'true'
84
109
run : |
85
110
pushd docs/_build/html; FILES=$(find . -name \* -print | grep html | cut -c2- | sort | uniq | tr '\n' ' '); popd
86
111
for file in $FILES; do
91
116
92
117
- name : Invalidate on CloudFront
93
118
uses : chetan/invalidate-cloudfront-action@master
119
+ if : env.PUBLISH == 'true'
94
120
env :
95
121
DISTRIBUTION : ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }}
96
122
AWS_REGION : ' us-east-1'
0 commit comments