Skip to content

Commit

Permalink
Add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmpr committed Oct 1, 2023
1 parent 999c029 commit 61b4169
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
insert_final_newline = true
indent_style = space

[*.{yml,yaml}]
indent_size = 2
ij_yaml_indent_sequence_value = false
57 changes: 57 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish package

on:
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: Publish kataloger to PyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build

- name: Publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run:
twine upload dist/*

create-release:
name: Create GitHub release
needs: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: SebRollen/toml-action@v1.0.2
id: read_version
with:
file: pyproject.toml
field: project.version

- uses: softprops/action-gh-release@v1
name: Create release
with:
body_path: ${{ github.workspace }}/changelog.md
name: v${{ steps.read_version.outputs.value }}
tag_name: v${{ steps.read_version.outputs.value }}
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Run tests

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build:
run-tests:
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ Cataloger has convenient API (I did my best), so you can install it from pip and
- [ ] Support check multiple catalogs
- [ ] Support all notations in version catalog
- [ ] Support advanced update configuration
- [ ] Support Python <3.11
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Changelog

* Initial release!🚀
3 changes: 3 additions & 0 deletions src/kataloger/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from importlib.metadata import version

__version__ = version(__package__ or __name__)
3 changes: 2 additions & 1 deletion src/kataloger/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import asyncio

from kataloger import __version__ as kataloger_version
from kataloger.catalog_updater_builder import CatalogUpdaterBuilder
from kataloger.data.kataloger_configuration import KatalogerConfiguration
from kataloger.execptions.kataloger_configuration_exception import KatalogerConfigurationException
Expand Down Expand Up @@ -58,7 +59,7 @@ def parse_arguments() -> KatalogerConfiguration:
parser.add_argument(
"--version",
action="version",
version=f"%(prog)s 0.0.1", # TODO: to be read from single-source
version=f"%(prog)s {kataloger_version}",
)
arguments = parser.parse_args()

Expand Down

0 comments on commit 61b4169

Please sign in to comment.