From 15b40350d8584ad136de9bc419021ef797303afa Mon Sep 17 00:00:00 2001 From: tonyfast Date: Tue, 21 Nov 2023 01:27:45 -0800 Subject: [PATCH] use pypa action --- .github/workflows/release.yml | 52 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f317f9d..b76d67fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,34 +1,32 @@ - name: Python package on: - push: - tags: - - '*' release: - types: [published] + types: [published] jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install hatch - - name: Test the project - run: hatch run test:run - - name: Build - run: hatch build - - name: Publish package - run: hatch publish -r test - if: github.event_name != 'release' - - name: Test the released packaged - run: hatch run release:test - if: github.event_name != 'release' - - name: Publish to mainline - run: hatch publish --user - if: github.event_name != 'release' + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install hatch + - name: Test the project + run: hatch run test:run + - name: Build + run: hatch build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + if: github.event_name != 'release' + - name: Test the released packaged + run: hatch run release:test + if: github.event_name != 'release' + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name != 'release'