Skip to content

Commit

Permalink
Add: [Actions] Release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LordAro committed Apr 20, 2020
1 parent f2480fe commit 0ed9d10
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/release.yml
@@ -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

0 comments on commit 0ed9d10

Please sign in to comment.