From f56162941c8b6908a51f3b71caecad9be2ead459 Mon Sep 17 00:00:00 2001 From: monoxgas Date: Wed, 31 Jan 2024 02:53:15 -0700 Subject: [PATCH] Add publish workflow --- .github/workflows/publish.yml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..71a6ec2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +name: Build and Publish + +on: + push: + branches: [ main ] + +jobs: + build-and-publish: + environment: protected + permissions: + contents: read + id-token: write + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Setup Poetry + uses: abatilo/actions-poetry@v2 + + - name: Configure local .venv + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + + - uses: actions/cache@v3 + name: Cache Dependencies + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + + - name: Install dependencies + run: poetry install + + - name: Build package + run: poetry build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file