Skip to content

Commit

Permalink
Merge pull request #209 from RDFLib/feat/supermodel
Browse files Browse the repository at this point in the history
Add release workflow
  • Loading branch information
edmondchuc authored Feb 19, 2024
2 parents 3cf7e15 + 75f1e4c commit 36d663b
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release to PyPI

on:
release:
types:
- published

env:
PYTHON_VERSION: "3.12"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
# Required by WyriHaximus/github-action-get-previous-tag
fetch-depth: 0

- name: Get latest tag
id: latest-tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: "0.1.0"

- name: Tag starts with v
id: tag-starts-with-v
if: ${{ startsWith(steps.latest-tag.outputs.tag, 'v') }}
uses: mad9000/actions-find-and-replace-string@2
with:
source: ${{ steps.latest-tag.outputs.tag }}
find: "v"
replace: ""

- name: Tag value
id: version
uses: haya14busa/action-cond@v1
with:
cond: ${{ startsWith(steps.latest-tag.outputs.tag, 'v') }}
if_true: ${{ steps.tag-starts-with-v.outputs.value }}
if_false: ${{ steps.latest-tag.outputs.tag }}

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Python Poetry
uses: snok/install-poetry@v1

- name: Install project
run: |
poetry install
- name: Publish to PyPI
run: |
poetry version ${{ steps.version.outputs.value }}
poetry build
poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
5 changes: 4 additions & 1 deletion pylode/version.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
__version__ = "3.0.6a"
import pkg_resources

version = pkg_resources.get_distribution("pylode").version
__version__ = version
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pylode"
version = "3.0.6a"
version = "3.1.0a"
description = "An OWL ontology documentation tool using Python, based on LODE."
authors = ["Nicholas Car <[email protected]>"]
readme = "README.rst"
Expand Down

0 comments on commit 36d663b

Please sign in to comment.