Skip to content

Commit

Permalink
Build wheel workflow: use Poetry to build the wheel
Browse files Browse the repository at this point in the history
Additionally, check whether the tag matches the package version.
  • Loading branch information
brechtm committed Jan 25, 2021
1 parent 263e46f commit bc8d891
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v[0-9]+.[0-9]+.[0-9]+.dev[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -20,17 +20,32 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8' # Version range or exact version of a Python version to use, using SemVer's version range syntax
python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified

# Build the wheel
- name: Run a multi-line script
- name: Install Poetry
uses: Gr1N/setup-poetry@v4
with:
poetry-version: 1.1.4

- name: Get version from tag
uses: olegtarasov/[email protected]
with:
tagRegex: "v(.*)"
- name: Get package version from Poetry
run: echo "PKG_VERSION=$(poetry version --short)" >> $GITHUB_ENV
- name: Check whether the tag matches the package version
run: python -c "import os, sys;
tag_version = os.getenv('GIT_TAG_NAME');
pkg_version = os.getenv('PKG_VERSION');
exit(0 if (tag_version == pkg_version) else 1)"

- name: Build the wheel
run: |
pip install wheel
python setup.py bdist_wheel
poetry build --format wheel
# Publish the wheel as a release on GitHub
- uses: ncipollo/release-action@v1
- name: Publish the wheel as a release on GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "dist/rinohtype-*.whl"
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit bc8d891

Please sign in to comment.