From 95be3e4288bd67539383500c4e0e79b6a94956ec Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 20 May 2023 17:37:49 -0400 Subject: [PATCH 1/2] ci: auto release version --- .github/workflows/publish-to-test-pypi.yml | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/publish-to-test-pypi.yml diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml new file mode 100644 index 0000000..df2116d --- /dev/null +++ b/.github/workflows/publish-to-test-pypi.yml @@ -0,0 +1,59 @@ +name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI +on: push + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: cache poetry install + uses: actions/cache@v2 + with: + path: ~/.local + key: poetry-1.3.2-0 + + - uses: snok/install-poetry@v1 + with: + version: 1.3.2 + virtualenvs-create: true + virtualenvs-in-project: true + + - name: cache deps + id: cache-deps + uses: actions/cache@v2 + with: + path: .venv + key: pydeps-${{ hashFiles('**/poetry.lock') }} + + # Install dependencies. `--no-root` means "install all dependencies but not the project + # itself", which is what you want to avoid caching _your_ code. The `if` statement + # ensures this only runs on a cache miss. + - run: poetry install --no-interaction --no-root + if: steps.cache-deps.outputs.cache-hit != 'true' + + # Now install _your_ project. This isn't necessary for many types of projects -- particularly + # things like Django apps don't need this. But it's a good idea since it fully-exercises the + # pyproject.toml and makes that if you add things like console-scripts at some point that + # they'll be installed and working. + - run: poetry install --no-interaction + + - name: build + run: ./s/build + + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + + - name: Publish distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} From 27e21f08065cf6ac5bdf04f4ab8d92d4ee976c3e Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 20 May 2023 20:50:15 -0400 Subject: [PATCH 2/2] fix --- .github/workflows/publish-to-test-pypi.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index df2116d..1dee439 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -46,12 +46,6 @@ jobs: - name: build run: ./s/build - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository-url: https://test.pypi.org/legacy/ - - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1