From 45a591191ef8f4fe80b16e57bb5df1b78a0146f4 Mon Sep 17 00:00:00 2001 From: Suraj Pai Date: Sun, 7 May 2023 20:32:12 -0400 Subject: [PATCH] Add auto publish workflow (#64) * Test first auto publish * Update auto-publish * Bump version * Update running branch --------- Co-authored-by: GitHub Action --- .github/workflows/auto-publish.yml | 38 ++++++++++++++++++++++++++++++ Makefile | 2 +- lighter/__init__.py | 2 +- lighter/version.py | 1 + pyproject.toml | 4 ++-- 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/auto-publish.yml create mode 100644 lighter/version.py diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml new file mode 100644 index 00000000..708f16e2 --- /dev/null +++ b/.github/workflows/auto-publish.yml @@ -0,0 +1,38 @@ +name: Auto Publish +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2.2.2 + with: + python-version: 3.8 + + - name: Install poetry + run: make setup + + - name: Bump version + run: | + poetry version prerelease + + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git commit -m "Bump version" || echo "No changes to commit" + git push + + - name: Build and publish to pypi + uses: JRubics/poetry-publish@v1.16 + with: + python_version: 3.8 + pypi_token: ${{ secrets.PYPI_TOKEN }} + allow_poetry_pre_release: "yes" + ignore_dev_requirements: "yes" diff --git a/Makefile b/Makefile index 7e252fe3..5c8f11f8 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ setup: poetry-download @echo export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring >> ~/.profile source ~/.bashrc source ~/.profile - poetry self add poetry-bumpversion + poetry self add poetry-bumpversion@latest .PHONY: poetry-download diff --git a/lighter/__init__.py b/lighter/__init__.py index ea91c118..20273aad 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -1,2 +1,2 @@ -__version__ = "0.0.1" from .system import LighterSystem +from .version import __version__ diff --git a/lighter/version.py b/lighter/version.py new file mode 100644 index 00000000..2700e7d2 --- /dev/null +++ b/lighter/version.py @@ -0,0 +1 @@ +__version__ = "0.0.2a1" diff --git a/pyproject.toml b/pyproject.toml index 3b4877ad..1a08f79b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ lighter = "lighter.utils.cli:interface" [tool.poetry] name = "project-lighter" -version = "0.0.1" +version = "0.0.2a1" description = "YAML-based automated rapid prototyping framework for deep learning experiments" readme = "README.md" authors = ["Ibrahim Hadzic " , @@ -182,4 +182,4 @@ generated-members = "torch.*" [tool.pylint.master] fail-under=8 -[tool.poetry_bumpversion.file."lighter/__init__.py"] +[tool.poetry_bumpversion.file."lighter/version.py"]