diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index fd9a50f29..31b202f0b 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -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: @@ -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/get-tag@v2.1 + 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 }}