-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github Action workflow to build ans publish packages on PyPI
- Loading branch information
Showing
1 changed file
with
123 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,123 @@ | ||
name: "Build and Publish Python Packages" | ||
|
||
on: | ||
push: | ||
tags: "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
|
||
build_sdist: | ||
|
||
name: "Source distribution" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: "Checkout the repository" | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: "Set up Python" | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: "Build source distribution" | ||
run: | | ||
python setup.py sdist | ||
- name: "Upload artifacts" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: yoga-image-optimizer-sdist | ||
path: dist/ | ||
retention-days: 1 | ||
|
||
build_wheel_linux: | ||
|
||
strategy: | ||
matrix: | ||
python-version: [cp37-cp37m, cp38-cp38, cp39-cp39] | ||
|
||
name: "Wheel for ${{ matrix.python-version }} manylinux2010" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: "Checkout the repository" | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Build Python Wheel for Linux (manylinux2010)" | ||
uses: RalfG/[email protected]_x86_64 | ||
with: | ||
python-versions: ${{ matrix.python-version }} | ||
build-requirements: cffi>=1.0.0 | ||
|
||
- name: "Upload artifacts" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: yoga-image-optimizer-wheel-linux | ||
path: dist/*manylinux*.whl | ||
retention-days: 1 | ||
|
||
build_wheel_windows: | ||
|
||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
|
||
name: "Wheel for py${{ matrix.python-version }} win amd64" | ||
runs-on: windows-latest | ||
|
||
steps: | ||
|
||
- name: "Checkout the repository" | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: "Set up Python ${{ matrix.python-version }}" | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: "Install Python dependencies" | ||
run: | | ||
pip install wheel | ||
- name: "Build Python Wheel" | ||
run: | | ||
python setup.py bdist_wheel | ||
- name: "Upload artifacts" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: yoga-image-optimizer-wheel-windows | ||
path: dist/ | ||
retention-days: 1 | ||
|
||
publish_pypi: | ||
|
||
name: "Publish packages on PyPI" | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build_sdist | ||
- build_wheel_linux | ||
- build_wheel_windows | ||
|
||
steps: | ||
|
||
- name: "Download artifacts" | ||
uses: actions/download-artifact@v2 | ||
|
||
- name: "Move packages to the dist/ folder" | ||
run: | | ||
mkdir dist/ | ||
mv yoga-image-optimizer-sdist/* dist/ | ||
mv yoga-image-optimizer-wheel-*/*.whl dist/ | ||
- name: "Publish packages on PyPI" | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |