From c659392672b00b7f2db788c53bdbe9068f6bc60b Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Sat, 29 Oct 2022 15:21:22 +0200 Subject: [PATCH 1/2] release CI: Run on all pushes and PRs, only publish on tag 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. --- .github/workflows/release.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7600a15de93..0f35c891e85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,5 @@ name: Release -on: - release: - types: - - published +on: [push, pull_request, workflow_dispatch] permissions: id-token: write @@ -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 }} From bde16fa6672a99dca42b11e5b422cddc1cb9ae6c Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Sat, 28 Oct 2023 12:04:18 +0200 Subject: [PATCH 2/2] Release CI: Run on pushes only to main and release branches Same configuration as in build_lint.yml --- .github/workflows/release.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f35c891e85..1b401a050b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,17 @@ name: Release -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + - release** + paths-ignore: + - '**.md' + - '**.rst' + pull_request: + paths-ignore: + - '**.md' + - '**.rst' + workflow_dispatch: permissions: id-token: write