From 5717268e5366f80cceb5d1d347e1d4b0be343b7d Mon Sep 17 00:00:00 2001 From: Melissa DeLucchi <113376043+delucchi-cmu@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:53:33 -0400 Subject: [PATCH] Create virtual environment and ignore changes to requirements file. (#412) * This will work * tresting * Remove generated requirements file * Ignore changed file * Allow re-try of pypi release. --- .github/workflows/publish-to-pypi.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 4bb48505..c429f460 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -11,7 +11,8 @@ name: Upload Python Package on: release: types: [published] - + workflow_dispatch: + permissions: contents: read @@ -32,15 +33,18 @@ jobs: python -m pip install --upgrade pip - name: Create lock requirements file in virtual environment run: | - . .venv/bin/activate + python -m venv .venv + source .venv/bin/activate python -m pip install . - python -m pip list --format=freeze --exclude "hats-import" > requirements.txt + python -m pip list --format=freeze --exclude "hats-import" --exclude pip > requirements.txt python -m pip install .[dev] python -m pytest tests python -m pip uninstall -y hats-import - name: Install build tools run: pip install build - name: Build package - run: python -m build + run: | + git update-index --assume-unchanged requirements.txt + python -m build - name: Publish package uses: pypa/gh-action-pypi-publish@release/v1