Skip to content

Commit

Permalink
Update Pythons, workflows for Poetry 1.2.0 release (#7)
Browse files Browse the repository at this point in the history
* 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:

python-poetry/poetry#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
  • Loading branch information
mpeteuil committed Sep 3, 2022
1 parent da36fc4 commit bb0ed68
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 15 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <michael.peteuil@gmail.com>"]
license = "MIT"
Expand All @@ -16,7 +16,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.6"
python = ">=3.7,<4"
poetry = ">=1.2.0a1"
python-dotenv = ">=0.10.0"

Expand Down

0 comments on commit bb0ed68

Please sign in to comment.