bump version #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Python project using sdist bdist_wheel | |
# and publish to PyPI. | |
name: Publish | |
on: | |
push: | |
tags: | |
- 'v*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
ARTIFACT_NAME: torch_ecg_dist | |
ARTIFACT_DIR: dist | |
# OS_NAME_VERSION: ubuntu-latest | |
jobs: | |
build: | |
# Don't run on forked repos. | |
if: github.repository_owner == 'DeepPSP' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
cache: 'pip' # caching pip dependencies | |
- name: List existing Python packages | |
run: | | |
python -m pip list | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel build | |
pip install -r requirements.txt | |
- name: Install Hatch | |
uses: pypa/hatch@install | |
- name: List installed Python packages | |
run: | | |
python -m pip list | |
- name: Build | |
run: | | |
python -m build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: $ARTIFACT_NAME | |
path: dist | |
pypi-publish: | |
# publishing is separate from building | |
needs: build | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: $ARTIFACT_NAME | |
path: $ARTIFACT_DIR | |
- name: Publish package to TestPyPI # to test, use https://test.pypi.org/ | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
packages-dir: $ARTIFACT_DIR | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_TORCH_ECG_TOKEN }} | |
packages-dir: $ARTIFACT_DIR | |
github-release: | |
# github release and changelog | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build Changelog | |
id: changelog | |
uses: mikepenz/release-changelog-builder-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: ${{ steps.changelog.outputs.changelog }} |