Skip to content

Commit

Permalink
Release on PyPI (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-andreas authored Mar 6, 2020
1 parent 50618be commit c8c7262
Show file tree
Hide file tree
Showing 32 changed files with 1,780 additions and 379 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on: [push]

jobs:
build:
name: Build and Test

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Build and install
run: |
pip install .
- name: Build distributions
run: |
pip install setuptools wheel
python setup.py sdist bdist_wheel
lint:
name: Lint and Autoformat

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Black Code Formatter
id: black
run: |
pip install black
black .
git diff --quiet && git diff --staged --quiet
has_changed=$?
echo "::set-output name=has_changed::$has_changed"
echo $has_changed
- name: Commit black changes
if: steps.black.outputs.has_changed == 1
run: |
git config --global user.name 'Felix Andreas'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.REPO_ACCESS_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated Code Formatting using Black"
git push
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Byte-compiled / optimized / DLL files
# OS and IDE
.DS_Store
.idea
.vscode

# Byte-compiled / optimized / DLL files / Cache
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
.mypy_cache/

# Distribution / packaging
.Python
build/
dist/
sdist/
wheels/
*.egg
*.egg-info/
Loading

0 comments on commit c8c7262

Please sign in to comment.