Skip to content

Commit

Permalink
ci: fix poetry publish error
Browse files Browse the repository at this point in the history
  • Loading branch information
zitsen committed Apr 28, 2022
1 parent 980aed5 commit ff56028
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 46 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Poetry Setup
uses: abatilo/[email protected]
- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
88 changes: 42 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@ on:
- "v*"

jobs:
pypi:
name: Publish to PyPI
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Poetry Setup
uses: abatilo/[email protected]
- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry publish --build -n --username __token__ --password "$PYPI_TOKEN"
release:
name: GitHub Release
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Build tools
run: |
Expand All @@ -21,6 +37,31 @@ jobs:
run: |
sudo apt-get install -y python3 python3-pip python-is-python3
- name: Poetry Setup
uses: abatilo/[email protected]

# Poetry cache with default ~.cache/pypoetry directory.
# Update it when `poetry.lock` file changed.
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
with:
path: ~/.cache/pypoetry
key: ubuntu-20.04-poetry-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction

- name: Set up Go
uses: actions/setup-go@v2
with:
Expand All @@ -47,50 +88,12 @@ jobs:
./TDengine/build/build/bin/taosadapter &
./TDengine/build/build/bin/taosd -c /tmp/taos/ &
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
with:
path: ~/.poetry
key: ubuntu-20.04-poetry
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction

#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Test
run: |
export LD_LIBRARY_PATH=$PWD/TDengine/build/build/lib
source $VENV
poetry run pip install psutil pandas
poetry run pytest tests
- name: Build Artifacts
Expand All @@ -108,10 +111,3 @@ jobs:
body_path: ${{ github.workflow }}-CHANGELOG.txt
files: |
dist/*
- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build -n

0 comments on commit ff56028

Please sign in to comment.