From 79d1983ee01b842fcc5028b923117d9f044ab8cc Mon Sep 17 00:00:00 2001 From: Regen Date: Sun, 8 Jan 2023 17:09:44 +0900 Subject: [PATCH] Update CI and CD --- .github/workflows/publish.yml | 38 +++++++++++++++++++---------------- .github/workflows/tests.yml | 2 +- .gitignore | 2 ++ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 478c9f7..c84e1aa 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,26 +1,30 @@ name: Publish on: + pull_request: push: tags: - v* jobs: - build-n-publish: - name: Build and publish - runs-on: ubuntu-18.04 + publish: + name: Publish to PyPI + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@master - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Install dependencies - run: | - python -m pip install poetry - - name: Build a binary wheel and a source tarball - run: | - poetry build - - name: Publish distribution to PyPI - run: | - poetry publish -u __token__ -p ${{ secrets.pypi_password }} + - name: Checkout + uses: actions/checkout@v3 + - name: Set up PDM + uses: pdm-project/setup-pdm@v3 + - name: Build + run: | + pdm build + - name: Publish package to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_PASSWORD }} + repository_url: https://test.pypi.org/legacy/ + - name: Publish package + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6572cb7..e8d364f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,7 +46,7 @@ jobs: env: os: ${{ matrix.os }} - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests diff --git a/.gitignore b/.gitignore index 06817c7..51daf68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/build/ +/dist/ __pycache__/ .tox/