Skip to content

Commit

Permalink
Update deploy Actions for upload-artifact v4
Browse files Browse the repository at this point in the history
The deploy action should also now only run on creating a new Release in Github.
  • Loading branch information
sserita committed Feb 7, 2024
1 parent 2d4fe84 commit 4a1caf2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/autodeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: Deploy new version on pypi.org
on:
push:
branches: [ "master" ]
# Pattern matched against refs/tags
tags:
- 'v*' # Push events to every tag not containing '/' (use '**' for hierarchical tags)
release:
types:
- published

# Dont allow running manually from Actions tab -- use manualdeploy for this
#workflow_dispatch:
Expand All @@ -17,7 +17,6 @@ jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # doesn't work -- try using tags: above

strategy:
matrix:
Expand All @@ -33,14 +32,15 @@ jobs:
python-version: '3.10'

- name: Build wheels
uses: pypa/cibuildwheel@v2.1.2
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-*
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_ALL_LINUX: ./.github/ci-scripts/before_install.sh

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
Expand All @@ -63,20 +63,19 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v' -- doesn't work -> try using tags: above
#if: github.event_name == 'push' && startsWith(github.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'
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish package on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/manualdeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
Expand All @@ -55,6 +56,7 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
Expand All @@ -63,8 +65,9 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish package on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down

0 comments on commit 4a1caf2

Please sign in to comment.