From d33dcea47b54b5030954d32f1eadc7cdb8401fad Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Mon, 19 Aug 2024 21:46:06 +0530 Subject: [PATCH 1/5] added release workflow --- .github/workflows/release.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..85d4f0f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,11 @@ +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 3ed4b80cc421d28032eb286ab4ecd3b143b42e62 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Thu, 22 Aug 2024 20:05:08 +0530 Subject: [PATCH 2/5] added build steps to release workflow --- .github/workflows/release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 85d4f0f..4ab108e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,5 +7,24 @@ jobs: id-token: write steps: + - name: Checkout pybamm-cookie + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Set up uv + uses: yezz123/setup-uv@v4 + with: + uv-venv: ".venv" + + - name: Install dependencies + run: uv pip install build hatch + + - name: Build package + run: python -m build + - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 From 1d02b11e650f6df8aa72e1bd11f04194c54a15af Mon Sep 17 00:00:00 2001 From: Santhosh <52504160+santacodes@users.noreply.github.com> Date: Thu, 22 Aug 2024 20:26:54 +0530 Subject: [PATCH 3/5] Update .github/workflows/release.yml Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ab108e..b36cb40 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,4 +27,4 @@ jobs: run: python -m build - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 From 953e46f7854e8680523eaaf32cd615dc8ed5577a Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Thu, 22 Aug 2024 21:39:15 +0530 Subject: [PATCH 4/5] separated build and publish jobs --- .github/workflows/release.yml | 41 ++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b36cb40..ffcff0c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,8 @@ jobs: - pypi-publish: - name: upload release to PyPI + build-wheels: + name: upload pybamm-cookie wheel artifacts runs-on: ubuntu-latest - environment: release - permissions: - id-token: write steps: - - name: Checkout pybamm-cookie - uses: actions/checkout@v4 @@ -15,16 +11,31 @@ jobs: with: python-version: 3.12 - - name: Set up uv - uses: yezz123/setup-uv@v4 + - name: Build package + run: pipx run build + + - name: Upload artifacts + uses: actions/upload-artifact@v4.3.6 with: - uv-venv: ".venv" + name: pybamm_cookie_wheel + path: ./dist/*.whl + if-no-files-found: error - - name: Install dependencies - run: uv pip install build hatch + publish-pypi: + name: Upload package to PyPI + needs: [build-wheels] + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write - - name: Build package - run: python -m build + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 + with: + packages-dir: artifacts/ From ae174abfb3c8381843396f33d4be93292afc17d6 Mon Sep 17 00:00:00 2001 From: Santhosh <52504160+santacodes@users.noreply.github.com> Date: Thu, 22 Aug 2024 22:03:31 +0530 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --- .github/workflows/release.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffcff0c..9136a66 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ jobs: - build-wheels: - name: upload pybamm-cookie wheel artifacts + build: + name: Build and pybamm-cookie sdist and wheel runs-on: ubuntu-latest steps: - name: Checkout pybamm-cookie @@ -8,8 +8,6 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 - with: - python-version: 3.12 - name: Build package run: pipx run build @@ -17,13 +15,13 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4.3.6 with: - name: pybamm_cookie_wheel - path: ./dist/*.whl + name: sdist_and_wheel + path: ./dist/* if-no-files-found: error publish-pypi: name: Upload package to PyPI - needs: [build-wheels] + needs: [build] runs-on: ubuntu-latest environment: release permissions: @@ -34,6 +32,7 @@ jobs: uses: actions/download-artifact@v4 with: path: artifacts + merge-multiple: true - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0