forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (77 loc) · 3.16 KB
/
docs.yaml
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
72
73
74
75
76
77
name: Build docs
on:
push:
paths-ignore:
- 'client/**'
- 'lib/galaxy_test/selenium/**'
pull_request:
paths-ignore:
- 'client/**'
- 'lib/galaxy_test/selenium/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8']
steps:
- name: Get target branch name (push)
if: github.event_name == 'push'
run: echo "TARGET_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Get target branch name (pull request)
if: github.event_name == 'pull_request'
run: echo "TARGET_BRANCH=$GITHUB_BASE_REF" >> $GITHUB_ENV
- name: Show target branch name
run: echo $TARGET_BRANCH
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dir
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
- name: Install Python dependencies
run: pip install -r requirements.txt -r lib/galaxy/dependencies/dev-requirements.txt sphinxcontrib-simpleversioning
- name: Add Google Analytics to doc/source/conf.py
run: |
sed -i -e "/html_theme_options = {/a\
\ 'analytics_id': 'UA-45719423-17'," -e "s#https://docs.galaxyproject.org/en/[^/]*/#https://docs.galaxyproject.org/en/$TARGET_BRANCH/#" doc/source/conf.py
- name: Checkout the latest doc/source/conf.versioning.py
if: github.event_name != 'push' || github.ref != 'refs/heads/dev'
run: |
# We cannot just download the latest version from dev, because it may be newer in this branch/PR
git fetch origin dev:dev
if [ ! -f doc/source/conf.versioning.py ] || [ "$(git log -1 --pretty="format:%ct" dev -- doc/source/conf.versioning.py)" -gt "$(git log -1 --pretty="format:%ct" -- doc/source/conf.versioning.py)" ]; then
git checkout dev -- doc/source/conf.versioning.py
fi
- name: Append doc/source/conf.versioning.py
run: cat doc/source/conf.versioning.py >> doc/source/conf.py
- name: Build docs
run: make docs
- name: Deploy docs
if: github.event_name == 'push' && github.repository_owner == 'galaxyproject'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
case "$TARGET_BRANCH" in
release_[[:digit:]][[:digit:]].[[:digit:]][[:digit:]] | release_[[:digit:]][[:digit:]].[[:digit:]] | master)
UPLOAD_DIR=$TARGET_BRANCH
;;
dev)
UPLOAD_DIR=latest
;;
*)
echo "Not deploying documentation for branch $TARGET_BRANCH"
exit 0
;;
esac
pip install awscli
aws s3 sync doc/build/html/ "s3://galaxy-docs/en/$UPLOAD_DIR" --region us-east-2 --size-only --delete