Skip to content

Commit

Permalink
Add github action for release
Browse files Browse the repository at this point in the history
and fix importlib.util import
  • Loading branch information
hmcezar committed Sep 25, 2023
1 parent 96f762e commit 3b44f3f
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Lint
name: Lint with black

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: psf/black@stable
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Upload clusttraj to PyPI when tag is pushed

on: push

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install pypa/build
run: |
python3 -m pip install --upgrade pip
python3 -m pip install build
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

testpypi-publish:
name: upload release to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: release
url: https://test.pypi.org/p/clusttraj

permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution packages to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

pypi-publish:
name: upload release to PyPI
needs:
- build
runs-on: ubuntu-latest

if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
environment:
name: release
url: https://pypi.org/p/clusttraj
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Sign and upload them to GitHub Release
needs:
- pypi-publish
runs-on: ubuntu-latest

if: startsWith(github.ref, 'refs/tags/') # only upload to GitHub Release on tag pushes
permissions:
contents: write
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
2 changes: 1 addition & 1 deletion clusttraj/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .main import main

__version__ = "0.1.0"
__version__ = "0.1.1"

__all__ = [
"main",
Expand Down
2 changes: 1 addition & 1 deletion clusttraj/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import rmsd
import logging
import importlib
import importlib.util
from typing import Callable, List, Union
from dataclasses import dataclass
from .utils import get_mol_info
Expand Down

0 comments on commit 3b44f3f

Please sign in to comment.