diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index 1e24986..39d2d16 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -1,14 +1,9 @@ -# This workflow will upload a Python Package to PyPI when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - name: Upload Python Package on: + push: + branches: + - '*' release: types: [published] @@ -16,11 +11,39 @@ permissions: contents: read jobs: - release-build: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y pipx + pipx install poetry + poetry install --no-root --with dev + + - name: Format check + run: | + poetry run ruff format --check --diff + + package-build: runs-on: ubuntu-latest + needs: + - build steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get tags + run: git fetch --tags origin - uses: actions/setup-python@v5 with: @@ -28,9 +51,8 @@ jobs: - name: Build release distributions run: | - # NOTE: put your own distribution build steps here. - python -m pip install build - python -m build + python3 -m pip install build + python3 -m build - name: Upload distributions uses: actions/upload-artifact@v4 @@ -41,13 +63,11 @@ jobs: pypi-publish: runs-on: ubuntu-latest needs: - - release-build + - package-build + if: github.event_name == 'release' permissions: - # IMPORTANT: this permission is mandatory for trusted publishing id-token: write - # Dedicated environments with protections for publishing are strongly recommended. - # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules environment: name: pypi url: https://pypi.org/p/fync diff --git a/.gitignore b/.gitignore index c04bc49..a6eeaee 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ poetry.lock +dist/ diff --git a/README.md b/README.md index 77dc9df..6212c95 100644 --- a/README.md +++ b/README.md @@ -20,24 +20,32 @@ pip install git+https://github.com/fanuware/fync.git ### Usage -fync [OPTIONS] COMMAND +fync[OPTIONS] COMMAND -#### Example +#### Example fync -- Observe changes in a specific directory and run a command +Observe changes in a specific directory and run a command - ```bash - fync --path=/path/to/observe execute_command - ``` +```bash +fync --path=/path/to/observe command +``` -- Use `cp` +Use `cp` - ```bash - fync cp source destination - ``` +```bash +fync cp source destination +``` -- Use `rsync` +Use `rsync` - ```bash - fync rsync -av source destination - ``` +```bash +fync rsync -av source destination +``` + +#### Example fync-get + +Authenticated file download + +```bash +fync-get +``` diff --git a/pyproject.toml b/pyproject.toml index e985144..2c8ec8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "fync" -version = "1.0.0" +dynamic = ["version"] description = "Automatically trigger command on directory update" authors = [{ name = "Fanuware", email = "fanuware@gmail.com" }] license = "MIT" repository = "https://github.com/fanuware/fync" readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.9,<4.0" packages = [ { include = "fync", from = "src" }, ] @@ -14,16 +14,23 @@ dependencies = [ "watchdog (>=6.0.0,<7.0.0)", ] +[tool.poetry] +version = "0.0.0" + +[tool.poetry-dynamic-versioning] +enable = true + [project.scripts] fync = 'fync:fync.cli' fync-get = 'fync:get.cli' [build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" +requires = ["poetry>=0.12", "poetry-dynamic-versioning>=1.0.0,<2.0.0"] +build-backend = "poetry_dynamic_versioning.backend" [tool.poetry.group.dev.dependencies] ruff = "^0.9.4" +poetry-dynamic-versioning = "^1.7.1" [tool.ruff] line-length = 79 diff --git a/src/fync/get.py b/src/fync/get.py index 293f990..6a451d0 100644 --- a/src/fync/get.py +++ b/src/fync/get.py @@ -66,7 +66,9 @@ def save_credentials(section, credentials): def cli(): - parser = argparse.ArgumentParser(description='File download.') + parser = argparse.ArgumentParser( + description='Authenticated file download.' + ) parser.add_argument( 'urls', nargs=argparse.REMAINDER, help='URLs to download from.' )