Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and upload to PyPI

on:
workflow_dispatch: # run on request (no need for PR)
release:
types: [published]

permissions: {} # No permissions by default on workflow level

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Python 3.10
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.10"
- name: Install pypa/build
run: |
python -m pip install --upgrade build
- name: Build sdist
run: |
python -m build --sdist ./
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-sdist
path: dist/*.tar.gz
- name: Build wheel
run: |
python -m build --wheel ./
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-wheel
path: dist/*.whl

publish_package:
name: Publish package
needs: [build]
environment: pypi
runs-on: ubuntu-latest
permissions:
contents: write # required by svenstaro/upload-release-action
id-token: write # required by trusted publisher
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: distr
pattern: artifact-*
merge-multiple: true
- name: Upload package distributions to github
uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # v2.11.2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: distr/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
packages-dir: distr/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ptflops versions log

## v 0.7.5
- Fix hook for nn.ConvTranspose2d

## v 0.7.4
- Fix hook for nn.functional.interpolate.
- Add ignore and custom modules for aten.
Expand Down