Skip to content

Publish package to pypi #7

Publish package to pypi

Publish package to pypi #7

name: Publish package to pypi
on:
push:
branches: [main]
paths:
- "src/coastpy/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/envs/312-release-package.yaml
# NOTE: 'poetry install' because we assume all packages are available in the release env
- name: Build package
run: |
poetry build
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
# Publish to PyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}