Skip to content

Commit

Permalink
Install deps in github actions instead of script
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Nov 7, 2020
1 parent 8f2131c commit 701ed6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- name: Create Build Environment
run: |
sudo apt install doxygen
sudo apt install doxygen python-virtualenv
sudo npm install -g less clean-css
cmake -E make_directory ${{runner.workspace}}/build
Expand Down
17 changes: 7 additions & 10 deletions support/build-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ def rmtree_if_exists(dir):
pass

def install_dependencies():
branch = os.environ['GITHUB_REF']
if branch != 'refs/heads/master':
print('Branch: ' + branch)
exit(0) # Ignore non-master branches
check_call('curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key ' +
'| sudo apt-key add -', shell=True)
check_call('echo "deb https://deb.nodesource.com/node_0.10 precise main" ' +
'| sudo tee /etc/apt/sources.list.d/nodesource.list', shell=True)
check_call(['sudo', 'apt-get', 'update'])
check_call(['sudo', 'apt-get', 'install', 'python-virtualenv'])
deb_file = 'doxygen_1.8.6-2_amd64.deb'
urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' +
deb_file, deb_file)
Expand All @@ -38,22 +28,29 @@ def install_dependencies():
build.create_build_env()
html_dir = build.build_docs()
repo = 'fmtlib.github.io'
branch = os.environ['GITHUB_REF']
if is_ci and branch != 'refs/heads/master':
print('Branch: ' + branch)
exit(0) # Ignore non-master branches
if is_ci and 'KEY' not in os.environ:
# Don't update the repo if building in CI from an account that doesn't have
# push access.
print('Skipping update of ' + repo)
exit(0)

# Clone the fmtlib.github.io repo.
rmtree_if_exists(repo)
git_url = 'https://github.com/' if is_ci else '[email protected]:'
check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)])

# Copy docs to the repo.
target_dir = os.path.join(repo, 'dev')
rmtree_if_exists(target_dir)
shutil.copytree(html_dir, target_dir, ignore=shutil.ignore_patterns('.*'))
if is_ci:
check_call(['git', 'config', '--global', 'user.name', 'fmtbot'])
check_call(['git', 'config', '--global', 'user.email', '[email protected]'])

# Push docs to GitHub pages.
check_call(['git', 'add', '--all'], cwd=repo)
if call(['git', 'diff-index', '--quiet', 'HEAD'], cwd=repo):
Expand Down

0 comments on commit 701ed6c

Please sign in to comment.