Merge pull request #56 from hrz6976/fix-v3 #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Semantic Release | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
release: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Build manylinux package | |
# manylinux2014_x86_64 doesn't support Python 2, | |
# use the default manylinux2010_x86_64 | |
uses: user2589/python-wheels-manylinux-build@master | |
with: | |
python-versions: 'cp27-cp27mu cp36-cp36m' | |
build-requirements: 'cython setuptools>=18.0' | |
system-packages: 'bzip2-devel zlib-devel' | |
- name: Remove non-manylinux binaries | |
# these are side products of manylinux, but are not supported by PyPI | |
# they will brake package upload later on if not removed | |
run: sudo find dist/ -type f ! -iname '*-manylinux*.whl' -delete | |
- name: Configure git | |
# https://github.com/python-semantic-release/python-semantic-release/issues/560 | |
# Context: | |
# https://github.com/python-semantic-release/python-semantic-release/commit/2a55f68e2b3cb9ffa9204c00ddbf12706af5c070 | |
# older version of semantic release is used because of compatibility | |
# issues with older Python | |
run: | | |
git config --system --add safe.directory "*" | |
- name: Python Semantic Release | |
# docs: https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html | |
uses: python-semantic-release/python-semantic-release@v7.9.0 | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
pypi_token: ${{ secrets.PYPI_TOKEN }} | |
pages: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout main branch | |
- uses: actions/checkout@v2 | |
name: Checkout gh-pages | |
with: | |
ref: gh-pages | |
path: docs/build/html | |
- name: Cache pip | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Build pages with sphinx | |
run: | | |
python3 -m pip install --upgrade pip setuptools wheel | |
# basically, make install_dev but explicitly use pip3 | |
pip3 install requests sphinx sphinx-autobuild | |
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi | |
# `make build` uses default python, which is often Python2 | |
# sphinx uses Python3, so make it explicit | |
python3 setup.py build_ext --inplace | |
export PATH=~/.local/bin:$PATH | |
make html | |
- name: Upload pages git gh-pages branch | |
run: | | |
cd docs/build/html | |
# since following git config is not --global, cd to repo dir first | |
git config user.name "github-actions" | |
git config user.email "github-actions@github.com" | |
git add . | |
# git commit will fail if there are no changes, thus ignore exit code | |
git commit -m "github pages" -a && git push || true |