From 0893ec8ed35ec798819b48c554a5325826b9f947 Mon Sep 17 00:00:00 2001 From: sage Date: Mon, 6 Jul 2020 16:39:28 +0700 Subject: [PATCH] Add publish workflow Move dist check to Lint. --- .github/workflows/dist.yml | 25 ------------------------- .github/workflows/lint.yml | 15 +++++++++++++++ .github/workflows/publish.yml | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/dist.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml deleted file mode 100644 index cc6ca8b..0000000 --- a/.github/workflows/dist.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Dist - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install tox - - name: Check package with twine - run: tox -e dist diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b49a455..c35018f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -53,3 +53,18 @@ jobs: pip install tox - name: Lint with isort run: tox -e isort . + + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Check package with twine + run: tox -e dist diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..600f146 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish + +on: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Build package + run: | + pip install --upgrade setuptools wheel + python setup.py sdist bdist_wheel + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_PASSWORD }}