From bb0ed688ff01c26c49994a6e0b59c2b4b35605f7 Mon Sep 17 00:00:00 2001 From: Michael Peteuil Date: Sat, 3 Sep 2022 13:59:03 -0400 Subject: [PATCH] Update Pythons, workflows for Poetry 1.2.0 release (#7) * Set bash as the default shell This removes the necessity of specifying the shell for every step that uses the shell. * Use the install script from Poetry's website * Include 3.10 in tests * Remove 3.6 support, require >=3.7,<4 Poetry removed 3.6 support in 1.2.0, so we can't support it here either. This was because 3.6's end-of-life was on December 23, 2021. For more information see: https://github.com/python-poetry/poetry/pull/5055 https://devguide.python.org/versions/ https://peps.python.org/pep-0494/ In addition to removing 3.6 support, we're moving this project to require Python >=3.7 and <4 * Use the new plugin add syntax * Create a release GitHub Actions workflow This will make it simpler to release versions in the future. * Bump version to remove pre-release --- .github/workflows/build.yml | 17 +++++------- .github/workflows/release.yml | 50 +++++++++++++++++++++++++++++++++++ README.md | 4 +-- pyproject.toml | 4 +-- 4 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9fc269..c40237b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,10 @@ jobs: strategy: matrix: os: [Ubuntu, MacOS] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9", "3.10"] + defaults: + run: + shell: bash steps: - uses: actions/checkout@v2 @@ -28,19 +31,15 @@ jobs: - name: Get full Python version id: full-python-version - shell: bash run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") - name: Install poetry - shell: bash - run: curl -sL https://raw.githubusercontent.com/python-poetry/poetry/1.2.0a1/install-poetry.py | python - -y --preview + run: curl -sL curl -sL https://install.python-poetry.org | python - -y - name: Update PATH - shell: bash run: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Configure poetry - shell: bash run: poetry config virtualenvs.in-project true - name: Set up cache @@ -52,17 +51,13 @@ jobs: - name: Ensure cache is healthy if: steps.cache.outputs.cache-hit == 'true' - shell: bash run: timeout 10s poetry run pip --version || rm -rf .venv - name: Install dependencies - shell: bash run: poetry install --no-root - name: Install poetry-dotenv-plugin - shell: bash - run: poetry plugin add "$GITHUB_WORKSPACE" + run: poetry self add "$GITHUB_WORKSPACE" - name: Run system tests - shell: bash run: tests/test_system.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bdd6067 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +# Based on +# https://github.com/python-poetry/poetry/blob/a0cc7d6b9ea9b59203ac01e4ac641643dc7c9c7a/.github/workflows/release.yml + +name: Release + +on: + push: + tags: + - '*.*.*' + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - name: Install Poetry + run: curl -sL https://raw.githubusercontent.com/python-poetry/poetry/1.2.0/install-poetry.py | python - -y + + - name: Update PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Build project for distribution + run: poetry build + + - name: Check Version + id: check-version + run: | + [[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ + || echo ::set-output name=prerelease::true + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/*" + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + prerelease: steps.check-version.outputs.prerelease == 'true' + + - name: Publish to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} + run: poetry publish diff --git a/README.md b/README.md index ebd7546..9677a03 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A [Poetry](https://python-poetry.org/) plugin that automatically loads environment variables from `.env` files into the environment before poetry commands are run. -Supports Python 3.6+ +Supports Python 3.7+ ```sh $ cat .env @@ -23,7 +23,7 @@ Initial implementation based on the event handler application plugin example in ## Install ```sh -poetry plugin add poetry-dotenv-plugin +poetry self add poetry-dotenv-plugin ``` ### Coming from Pipenv diff --git a/pyproject.toml b/pyproject.toml index d72fa01..999f2a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry-dotenv-plugin" -version = "0.1.0a2" +version = "0.1.0" description = "A Poetry plugin to automatically load environment variables from .env files" authors = ["Michael Peteuil "] license = "MIT" @@ -16,7 +16,7 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "^3.6" +python = ">=3.7,<4" poetry = ">=1.2.0a1" python-dotenv = ">=0.10.0"