Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
105 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '*' | ||
repository_dispatch: | ||
types: | ||
- publish_latest_tag | ||
- publish_master | ||
|
||
jobs: | ||
release: | ||
name: Python 3.x on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-2016] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v1 | ||
if: startsWith(matrix.os, 'ubuntu') | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- uses: actions/cache@v1 | ||
if: startsWith(matrix.os, 'macOS') | ||
with: | ||
path: ~/Library/Caches/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- uses: actions/cache@v1 | ||
if: startsWith(matrix.os, 'windows') | ||
with: | ||
path: ~\AppData\Local\pip\Cache | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
pip install -e . | ||
- name: Build manylinux Python wheels | ||
if: startsWith(matrix.os, 'ubuntu') | ||
uses: RalfG/python-wheels-manylinux-build@v0.2.2-manylinux2014_x86_64 | ||
with: | ||
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38' | ||
build-requirements: '-e .' # pip args | ||
|
||
- name: Publish manylinux Python wheels | ||
if: startsWith(matrix.os, 'ubuntu') | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
twine upload --username __token__ wheelhouse/*-manylinux*.whl | ||
- name: Build and publish wheel | ||
if: "! startsWith(matrix.os, 'ubuntu')" | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload --username __token__ dist/*.whl | ||
# Only do this on Windows to prevent file conflicts | ||
- name: Build and publish source distribution | ||
if: startsWith(matrix.os, 'windows') | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
twine upload --username __token__ dist/*.tar.gz | ||
- name: Build standalone executable | ||
if: startsWith(matrix.os, 'windows') | ||
run: | | ||
pip install --upgrade pyinstaller | ||
pyinstaller nmlc.spec | ||
$version = python setup.py --version | ||
echo "::set-output name=version::$version" | ||
id: nml_version | ||
|
||
- name: Archive executable | ||
if: startsWith(matrix.os, 'windows') | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: nml-${{ steps.nml_version.outputs.version }}-win64 | ||
path: dist/nmlc.exe |