102 lines
2.7 KiB
YAML
102 lines
2.7 KiB
YAML
name: Build distribution, test install & push releases to pypi
|
|
on:
|
|
push:
|
|
release:
|
|
types: [published, prereleased]
|
|
|
|
jobs:
|
|
build:
|
|
name: 🔨 Build distribution
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: 🏗 Set up Python 3.7
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.7
|
|
- name: 🏗 Install build dependencies
|
|
run: |
|
|
python -m pip install wheel --user
|
|
- name: 🔨 Build a binary wheel and a source tarball
|
|
run: |
|
|
python setup.py sdist bdist_wheel
|
|
- name: ⬆ Upload build result
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
|
|
test-install-py2:
|
|
name: 🧪 Test install on Python 2
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- name: ⬇ Download build result
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
- name: 🏗 Set up Python 2.7
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 2.7
|
|
- name: 🚀 Install wheel
|
|
run: |
|
|
pip install dist/OctoPrint-*-py2.py3-none-any.whl
|
|
|
|
test-install-py3:
|
|
name: 🧪 Test install on Python 3
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- name: ⬇ Download build result
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
- name: 🏗 Set up Python 3.7
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.7
|
|
- name: 🚀 Install wheel
|
|
run: |
|
|
pip install dist/OctoPrint-*-py2.py3-none-any.whl
|
|
|
|
publish-on-testpypi:
|
|
name: 📦 Publish on TestPyPI
|
|
if: github.event_name == 'release'
|
|
needs:
|
|
- test-install-py2
|
|
- test-install-py3
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: ⬇ Download build result
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
- name: 📦 Publish to index
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
continue-on-error: true
|
|
with:
|
|
password: ${{ secrets.testpypi_password }}
|
|
repository_url: https://test.pypi.org/legacy/
|
|
|
|
#publish-on-pypi:
|
|
# name: 📦 Publish tagged releases to PyPI
|
|
# if: github.event_name == 'release'
|
|
# needs: publish-on-testpypi
|
|
# runs-on: ubuntu-latest
|
|
# steps:
|
|
# - name: ⬇ Download build result
|
|
# uses: actions/download-artifact@v1
|
|
# with:
|
|
# name: dist
|
|
# path: dist
|
|
# - name: 📦 Publish to index
|
|
# uses: pypa/gh-action-pypi-publish@master
|
|
# with:
|
|
# password: ${{ secrets.pypi_password }}
|