From d114551bd1253548b0e6a414bb21fd2b243774f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 24 Jun 2020 16:21:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F=20Build?= =?UTF-8?q?=20&=20release=20automation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 101 ++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..01ba0e905 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,101 @@ +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.py2-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.py2-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 }}