Update upload/download-artifact #221
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
--- | |
name: Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v** | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Apply patches | |
run: cat $(ls patches/*.patch | sort) | patch -p1 -N | |
- name: Build sdist | |
run: pipx run poetry build -f sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz | |
name: sdist | |
build_wheels: | |
needs: [build_sdist] | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macos-10.15, windows-2019] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: sdist | |
path: dist | |
- name: Decompress sdist (windows) | |
if: startsWith(matrix.os, 'windows-') | |
run: tar --strip-components=1 -xf $(dir dist/*.tar.gz | % {$_.FullName}) | |
- name: Decompress sdist | |
if: "! startsWith(matrix.os, 'windows-')" | |
run: tar --strip-components=1 -xf dist/*.tar.gz | |
- name: Build wheel | |
uses: joerick/[email protected] | |
env: | |
CIBW_SKIP: cp2* cp35* pp* | |
CIBW_TEST_COMMAND: pytest --regression {package}/tests | |
CIBW_BEFORE_TEST: pip install pytest dials-data | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
# alternatively, to publish when a GitHub Release is created, use the following rule: | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: sdist | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |