Skip to content

Commit

Permalink
Merge pull request #10 from lasisilab/ci/update-release
Browse files Browse the repository at this point in the history
ci: update release
  • Loading branch information
jakevc authored Feb 12, 2024
2 parents 77aa20e + ba952dd commit 9d8bc54
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 30 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
name: Release

# release on push version tag, e.g. v0.3.2
on:
push:
branches:
- main
tags:
- 'v*.*.*'

permissions:
contents: write
pull-requests: write

env:
PYTHON_VERSION: 3.11

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- uses: GoogleCloudPlatform/release-please-action@v4
id: release
with:
release-type: python

publish:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3

Expand All @@ -45,11 +33,24 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

- name: Check if tag matches the package version
run: |
PKG_VERSION = $(poetry version -s)
TAG = ${GITHUB_REF#refs/tags/}
if [[ "v${PKG_VERSION}" != $TAG ]]; then
echo "Error: Tag ($TAG) does not match the package version (v${PKG_VERSION})."
exit 1
- name: Install Dependencies using Poetry
run: poetry install
run: poetry build

- uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
artifacts: "dist/*"

- name: Publish to PyPi
env:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --build --username $PYPI_USERNAME --password $PYPI_PASSWORD
run: poetry publish --username $PYPI_USERNAME --password $PYPI_PASSWORD
3 changes: 3 additions & 0 deletions fibermorph/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

import importlib.metadata
__version__= importlib.metadata.version('fibermorph')
1 change: 0 additions & 1 deletion fibermorph/_version.py

This file was deleted.

15 changes: 3 additions & 12 deletions fibermorph/fibermorph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# %% Import libraries
import argparse
import datetime
import os
Expand All @@ -11,7 +10,6 @@
from functools import wraps
from timeit import default_timer as timer

# import cv2
import numpy as np
import pandas as pd
import rawpy
Expand All @@ -32,18 +30,9 @@
from skimage.segmentation import clear_border
from skimage.util import invert
from tqdm import tqdm
#%%
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import demo

# Grab version from _version.py in the fibermorph directory
dir = os.path.dirname(__file__)
version_py = os.path.join(dir, "_version.py")
exec(open(version_py).read())

# %% Functions

# parse_args() and timing() listed first for easy updating/access
from fibermorph import __version__

def parse_args():
"""
Expand All @@ -53,6 +42,8 @@ def parse_args():
Parser argument namespace
"""
parser = argparse.ArgumentParser(description="fibermorph")

parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')

parser.add_argument(
"-o", "--output_directory", metavar="", default=None,
Expand Down

0 comments on commit 9d8bc54

Please sign in to comment.