From 373f4ca746cb3bc2ad2ca948843b5716409a9737 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Thu, 23 Apr 2020 16:02:57 +0100 Subject: [PATCH] Add Publish stage to Actions --- .github/workflows/publish.yml | 48 ++++++++++++++++++++++++++ .github/workflows/{ci.yml => test.yml} | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml rename .github/workflows/{ci.yml => test.yml} (99%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..c30d2b30 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,48 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Install Poetry + uses: dschep/install-poetry-action@v1.3 + + - name: Cache Poetry virtualenv + uses: actions/cache@v1 + id: cache + with: + path: ~/.virtualenvs + key: poetry-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + poetry-${{ hashFiles('**/poetry.lock') }} + + - name: Set Poetry config + env: + POETRY_PYPI_TOKEN_PYPI: ${{ POETRY_PYPI_TOKEN_PYPI }} + run: | + poetry config virtualenvs.in-project false + poetry config virtualenvs.path ~/.virtualenvs + poetry config pypi-token.pypi "$POETRY_PYPI_TOKEN_PYPI" + + - name: Install Dependencies + run: poetry install + if: steps.cache.outputs.cache-hit != 'true' + + - name: Build with Poetry + run: poetry build + + - name: Publish with Poetry + run: poetry publish diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 99% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index 6179a3d9..00ade04c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: CI +name: Test on: [push]