Skip to content

Commit af06796

Browse files
committed
maint: avoid double execution of GA
1 parent 3ad3567 commit af06796

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
name: Build docs
3+
4+
on:
5+
pull_request:
6+
branches: [ master, 'maint/*' ]
7+
8+
jobs:
9+
build:
10+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Determine current branch/tag name
17+
run: |
18+
if [[ "$GITHUB_REF" == refs/pull/* ]]; then
19+
CURBRANCH=${GITHUB_REF%/*}
20+
CURBRANCH=${CURBRANCH##*/}
21+
elif [[ "$GITHUB_REF" == refs/heads/* ]]; then
22+
CURBRANCH=${GITHUB_REF##*/}
23+
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
24+
echo "This build should not be picking up a tag, cancelling."
25+
exit 1
26+
fi
27+
28+
# Remove forward slashes
29+
CURBRANCH=$( echo $CURBRANCH | sed 's+/+_+g' )
30+
echo "Building branch/tag ${CURBRANCH:-<unkwown>}, from git ref <$GITHUB_REF>"
31+
echo "CURBRANCH=${CURBRANCH}" >> ${GITHUB_ENV}
32+
33+
- name: Install GraphViz
34+
run: |
35+
sudo apt-get update -y
36+
sudo apt-get install -y graphviz
37+
38+
- name: Install dependencies
39+
run: |
40+
pip install -r docs/requirements.txt
41+
42+
- name: Build docs
43+
run: |
44+
make -C docs/ SPHINXOPTS="-W" BUILDDIR="$HOME/docs" CURBRANCH="${CURBRANCH:-html}" html
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11

2-
name: Build docs
2+
name: Build & update docs
33

44
on:
55
push:
6-
branches: [ 'doc/*', 'docs/*' ]
7-
tags: [ '*' ]
8-
pull_request:
9-
branches: [ master, 'maint/*' ]
10-
11-
create:
6+
branches: [ 'doc/*', 'docs/*', master, "maint/*" ]
127
tags: [ '*' ]
138

149
jobs:
@@ -49,7 +44,7 @@ jobs:
4944
make -C docs/ SPHINXOPTS="-W" BUILDDIR="$HOME/docs" CURBRANCH="${CURBRANCH:-html}" html
5045
5146
- name: Push created tag to gh-pages
52-
if: github.event_name == 'create'
47+
if: startsWith(github.ref, 'refs/tags/')
5348
run: |
5449
MAJOR_MINOR=${CURBRANCH%.*}
5550
if [[ "${MAJOR_MINOR" == "" ]]; then
@@ -65,7 +60,7 @@ jobs:
6560
git commit -am "rel(${CURBRANCH}): Update docs of ${MAJOR_MINOR} series" || true
6661
git push
6762
68-
- name: Push merge commit into master to gh-pages
63+
- name: Push "master" docs to gh-pages after a PR is merged
6964
if: github.event.pull_request.merged == true
7065
run: |
7166
if [[ "${CURBRANCH" != "master" ]]; then

0 commit comments

Comments
 (0)