diff --git a/.github/workflows/publish-PyPI.yml b/.github/workflows/publish-PyPI.yml new file mode 100644 index 0000000..b4ccc90 --- /dev/null +++ b/.github/workflows/publish-PyPI.yml @@ -0,0 +1,63 @@ +name: Publish to PyPI +run-name: Publish Python Package to PyPI for release ${{ github.event.release.tag_name || inputs.tag_name || github.ref_name }} + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag_name: + description: 'Git tag to checkout and publish' + required: false + type: string + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag_name || github.ref }} + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + publish-to-pypi: + name: Publish to PyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: pypi + url: https://pypi.org/p/pygmt-helper + + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index 170a5a4..f1d0688 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,13 +3,14 @@ requires = ["setuptools","setuptools-scm"] build-backend = "setuptools.build_meta" [project] -name = "pygmt_helper" -version = "22.8.1" +name = "pygmt-helper" authors = [{name = "ucgmsim"}] description = "PyGMT helper package" readme = "ReadMe.md" requires-python = ">=3.11,<3.14" -dynamic = ["dependencies"] +dynamic = ["version", "dependencies"] + +[tool.setuptools_scm] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} diff --git a/requirements.txt b/requirements.txt index 5a7a365..07d846a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ pyproj xarray scipy shapely -qcore @ git+https://github.com/ucgmsim/qcore.git +qcore-utils pytest pytest-cov pooch