Skip to content

Automate package build and release #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 9, 2025
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
92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Publish Package

on: # yamllint disable-line rule:truthy
push:
branches:
- master
release:
types:
- published

defaults:
run:
shell: bash

jobs:
build-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install build tools
run: |
pip install -U pip
pip install -U flit twine
pip list

- name: Build package
run: |
flit build --no-use-vcs
twine check dist/* --strict

- uses: actions/upload-artifact@v4
with:
name: release-${{ github.sha }}
path: dist

publish-package-test:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [build-package]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Download package
uses: actions/download-artifact@v4
with:
name: release-${{ github.sha }}
path: dist

- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
username: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
verbose: true
print-hash: true

publish-package:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is nice also upload the package to the GH release page as an artifact :)

if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [publish-package-test]
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Download package
uses: actions/download-artifact@v4
with:
name: release-${{ github.sha }}
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
username: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
print-hash: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ venv/*
data/**
catboost_info/
.pt_tmp/
test_*.py
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build-backend="flit_core.buildapi"

[project]
name="pytorch-frame"
version="0.2.4"
authors=[
{name="PyG Team", email="team@pyg.org"},
]
dynamic=["version"]
description="Tabular Deep Learning Library for PyTorch"
readme="README.md"
requires-python=">=3.9"
Expand Down
Loading