Skip to content

Commit 36d663b

Browse files
authored
Merge pull request #209 from RDFLib/feat/supermodel
Add release workflow
2 parents 3cf7e15 + 75f1e4c commit 36d663b

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

.github/workflows/release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release to PyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
PYTHON_VERSION: "3.12"
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout the repo
16+
uses: actions/checkout@v4
17+
with:
18+
# Required by WyriHaximus/github-action-get-previous-tag
19+
fetch-depth: 0
20+
21+
- name: Get latest tag
22+
id: latest-tag
23+
uses: WyriHaximus/github-action-get-previous-tag@v1
24+
with:
25+
fallback: "0.1.0"
26+
27+
- name: Tag starts with v
28+
id: tag-starts-with-v
29+
if: ${{ startsWith(steps.latest-tag.outputs.tag, 'v') }}
30+
uses: mad9000/actions-find-and-replace-string@2
31+
with:
32+
source: ${{ steps.latest-tag.outputs.tag }}
33+
find: "v"
34+
replace: ""
35+
36+
- name: Tag value
37+
id: version
38+
uses: haya14busa/action-cond@v1
39+
with:
40+
cond: ${{ startsWith(steps.latest-tag.outputs.tag, 'v') }}
41+
if_true: ${{ steps.tag-starts-with-v.outputs.value }}
42+
if_false: ${{ steps.latest-tag.outputs.tag }}
43+
44+
- name: Install Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: ${{ env.PYTHON_VERSION }}
48+
49+
- name: Install Python Poetry
50+
uses: snok/install-poetry@v1
51+
52+
- name: Install project
53+
run: |
54+
poetry install
55+
56+
- name: Publish to PyPI
57+
run: |
58+
poetry version ${{ steps.version.outputs.value }}
59+
poetry build
60+
poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}

pylode/version.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
__version__ = "3.0.6a"
1+
import pkg_resources
2+
3+
version = pkg_resources.get_distribution("pylode").version
4+
__version__ = version

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pylode"
3-
version = "3.0.6a"
3+
version = "3.1.0a"
44
description = "An OWL ontology documentation tool using Python, based on LODE."
55
authors = ["Nicholas Car <[email protected]>"]
66
readme = "README.rst"

0 commit comments

Comments
 (0)