From 3751849c6a3c81837830ed8b34e621f95dcce5b5 Mon Sep 17 00:00:00 2001 From: Ben Mezger Date: Mon, 9 Oct 2023 20:08:14 +0200 Subject: [PATCH] Create a release workflow This moves the release process from the test workflow to a release workflow. This makes sure it only runs once, during the merge to main. --- .github/workflows/main.yml | 7 ------ .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b750a97..2bae4bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,10 +45,3 @@ jobs: uses: codecov/codecov-action@v3 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: Publish - env: - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: | - poetry config pypi-token.pypi $PYPI_TOKEN - poetry publish --build --skip-existing diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7d61174 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +on: + push: + branches: [main] + +jobs: + test: + needs: test + 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.6.1 + + - uses: snok/install-poetry@v1 + with: + version: 1.6.1 + 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') }} + + - run: poetry install --no-interaction --no-root + if: steps.cache-deps.outputs.cache-hit != 'true' + + - name: Install dependencies + run: poetry install --no-interaction + + - name: Publish + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + poetry config pypi-token.pypi $PYPI_TOKEN + poetry publish --build --skip-existing