Skip to content

Commit

Permalink
release CI: Run on all pushes and PRs, only publish on tag
Browse files Browse the repository at this point in the history
Currently the release CI only run when a GitHub Release is created. This PR modifies that is runs on each PR and push, and uploads.

It uses the official action from PyPI: https://github.com/pypa/gh-action-pypi-publish

It also now uses build to build the wheel, instead of calling setup.py directly, which is deprecated.
  • Loading branch information
EwoutH committed Oct 28, 2023
1 parent 3b580a3 commit c659392
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Release
on:
release:
types:
- published
on: [push, pull_request, workflow_dispatch]

permissions:
id-token: write
Expand All @@ -19,16 +16,17 @@ jobs:
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -U pip wheel setuptools
- name: Build package
run: python setup.py sdist bdist_wheel
run: pip install -U pip build wheel setuptools
- name: Build distributions
run: python -m build
- name: Upload package as artifact to GitHub
if: github.repository == 'projectmesa/mesa' && startsWith(github.ref, 'refs/tags')
uses: actions/upload-artifact@v3
with:
name: package
path: dist/
- name: Upload packages to PyPI
- name: Publish package to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit c659392

Please sign in to comment.