Skip to content

Commit

Permalink
ci/cd: fix version number for pypi
Browse files Browse the repository at this point in the history
Signed-off-by: Mimoja <[email protected]>
  • Loading branch information
Mimoja committed Jul 7, 2024
1 parent 18d90af commit 3977f75
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,38 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
cibw_arch: ["x86_64", "aarch64"]
cibw_arch: ["x86_64"]
env:
CIBW_BEFORE_ALL_LINUX: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y"
CIBW_BUILD_VERBOSITY: "1"
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"'

steps:
- uses: actions/checkout@v4
with:
fetch-tags: 'true'
fetch-depth: '0'

- name: "Install setuptools"
shell: bash
run: python3 -m pip install --upgrade setuptools>=61.2 setuptools_scm>=6.2

- name: Set a PyPI compatible setuptools_scm pretend version
# Required for continuously deploying to Test PyPI when we have commits not part of a tag/release
# See https://github.com/pypa/setuptools_scm/issues/478
run: |
import os
from setuptools_scm import get_version
real_version = get_version()
pretend_version = get_version(local_scheme='no-local-version')
if pretend_version != real_version:
print(f'Setting SETUPTOOLS_SCM_PRETEND_VERSION to {pretend_version} instead of using version {real_version}')
env_file = os.getenv('GITHUB_ENV')
with open(env_file, "a") as myfile:
myfile.write(f"SETUPTOOLS_SCM_PRETEND_VERSION={pretend_version}")
else:
print(f'Version {real_version} is compatible with PyPI. No action needed.')
shell: python
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest' && matrix.cibw_arch == 'aarch64'
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
Expand All @@ -30,6 +53,8 @@ jobs:
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.cibw_python }}
SETUPTOOLS_SCM_PRETEND_VERSION: ${{env.SETUPTOOLS_SCM_PRETEND_VERSION}}
PIP_NO_BUILD_ISOLATION: 1
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_TEST_SKIP: "*universal2:arm64"
with:
Expand Down Expand Up @@ -73,10 +98,12 @@ jobs:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
with:
name: dist
path: python/dist/
path: python/dist

- uses: pypa/[email protected]
with:
Expand Down

0 comments on commit 3977f75

Please sign in to comment.