From e7f458bfefb5f76126bde35293ef3541ca5e82e8 Mon Sep 17 00:00:00 2001 From: Hugh Sorby Date: Tue, 7 May 2024 18:39:04 +1200 Subject: [PATCH] Use hsorby/release-python-package-action to handle the release of codebase. --- .github/workflows/python-package-deploy.yml | 61 +++------------------ 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/.github/workflows/python-package-deploy.yml b/.github/workflows/python-package-deploy.yml index 297a344..937db9c 100644 --- a/.github/workflows/python-package-deploy.yml +++ b/.github/workflows/python-package-deploy.yml @@ -9,59 +9,16 @@ on: - "v*.*.*" jobs: - build: - - runs-on: ubuntu-latest + test-build-and-release-package: if: github.repository == 'hsorby/trc-data-reader' - strategy: - matrix: - python-version: [3.9] + runs-on: ubuntu-20.04 + name: Release package permissions: contents: write - id-token: write - + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools build wheel - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Test - run: | - python -m unittest discover - - name: Create Release - id: create_release - uses: KaiWedekind/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ github.token }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - - name: "Generate release changelog" - uses: heinrichreimer/action-github-changelog-generator@v2.3 - with: - token: ${{ github.token }} - - name: Add changelog to release - uses: irongut/EditRelease@v1.2.0 - with: - token: ${{ github.token }} - id: ${{ steps.create_release.outputs.id }} - files: "CHANGELOG.md" - - name: Build - id: build - shell: bash - run: | - python --version - python -m build . --wheel - echo "dist content:" - ls dist/ - - name: Publish to PyPi - env: - name: pypi - url: https://pypi.org/p/trc-data-reader - uses: pypa/gh-action-pypi-publish@release/v1 + - name: Release Python package + uses: hsorby/release-python-package-action@v1 + with: + pypi-package-name: trc-data-reader + run-tests: unittest