From b75649927bea31e9e83b0019623493521c3f2bdf Mon Sep 17 00:00:00 2001 From: Alex DeJarnatt Date: Thu, 13 Jun 2024 12:23:51 -0400 Subject: [PATCH] Publish release workflow (#37) * add python package release workflow * add test release workflow --- .github/workflows/python-release.yml | 8 +++- .github/workflows/python-test-release.yml | 54 +++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/python-test-release.yml diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 6ef28e8..b03597c 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -33,11 +33,14 @@ jobs: runs-on: ubuntu-latest needs: - build + environment: name: pypi - url: https://pypi.org/puzpy + url: https://pypi.org/p/puzpy + permissions: id-token: write # IMPORTANT: mandatory for trusted publishing + steps: - name: Download dist package uses: actions/download-artifact@v3 @@ -45,4 +48,5 @@ jobs: name: python-package-distributions path: dist/ - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file + uses: pypa/gh-action-pypi-publish@release/v1 + diff --git a/.github/workflows/python-test-release.yml b/.github/workflows/python-test-release.yml new file mode 100644 index 0000000..06a80a8 --- /dev/null +++ b/.github/workflows/python-test-release.yml @@ -0,0 +1,54 @@ +# This workflow builds the python dist and uploads to test pypi in response to a release being created +# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ + +name: publish release + +on: + release: + types: [ created ] + +jobs: + build: + name: Build dist package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install build + run: pip install build + - name: Build binary wheel and a source tarball + run: python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + + publish-to-testpypi: + name: Publish Python distribution to TestPyPI + runs-on: ubuntu-latest + needs: + - build + + environment: + name: testpypi + url: https://test.pypi.org/p/puzpy + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download dist package + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution package to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ \ No newline at end of file