Repository: infinyon/fluvio-client-python (language: python)

Issue:
Add docs to release artifacts
We want to build an archive of reference docs from older versions on the fluvio-website. The docs are already generated and hosted. Only need to keep track of each version. This will be easier to accomplish if we don't have to scrape with git.

Related https://github.com/infinyon/fluvio-website/issues/460


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
deleted file mode 100644
index fa4fe047..00000000
--- a/.github/workflows/docs.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-name: Docs
-
-on:
-  workflow_dispatch:
-  push:
-    branches: [ main ]
-    tags:
-      - 'v*'
-jobs:
-  cancel_previous_runs:
-    name: Cancel Previous Runs
-    runs-on: ubuntu-latest
-    steps:
-      - uses: styfle/cancel-workflow-action@0.11.0
-        with:
-          access_token: ${{ secrets.GITHUB_TOKEN }}
-  docs:
-    name: build and push static docs
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os: [ubuntu-latest]
-        python-version: ["3.11"]
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
-          fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
-      - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v4
-        with:
-          python-version: ${{ matrix.python-version }}
-      - name: "Git Fetch & Checkout"
-        run: |
-          git config --local user.email "team@fluvio.io"
-          git config --local user.name "Fluvio Authors"
-          git fetch --all
-          git checkout -b docs --track origin/docs
-          git merge -X theirs origin/main -m "Merge remote-tracking branch 'origin/main into docs" --allow-unrelated-histories
-      - name: Build docs
-        run: |
-          make docs-build
-          touch docs/.nojekyll
-      - name: Commit files
-        run: |
-          git add --force docs
-          git commit -m "Updated Fluvio Node.js client docs" -a || true
-      - name: Push changes
-        uses: ad-m/github-push-action@master
-        with:
-          github_token: ${{ secrets.GITHUB_TOKEN }}
-          branch: docs
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 831887be..ad9902e9 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -70,6 +70,7 @@ jobs:
 
       - uses: actions/upload-artifact@v3
         with:
+          name: wheel
           path: ./wheelhouse/*.whl
 
   build_sdist:
@@ -91,6 +92,7 @@ jobs:
 
       - uses: actions/upload-artifact@v3
         with:
+          name: wheel
           path: dist/*.tar.gz
 
   build_cc_wheels:
@@ -147,6 +149,7 @@ jobs:
             CARGO_BUILD_TARGET: ${{ matrix.platform.target }}
       - uses: actions/upload-artifact@v3
         with:
+          name: wheel
           path: dist/*.whl
 
   upload_pypi:
@@ -156,7 +159,7 @@ jobs:
     steps:
       - uses: actions/download-artifact@v3
         with:
-          name: artifact
+          name: wheel
           path: dist
 
       - uses: pypa/gh-action-pypi-publish@master
@@ -165,3 +168,102 @@ jobs:
           user: __token__
           password: ${{ secrets.PYPI_ACCESS_TOKEN }}
           skip_existing: true
+
+  build_docs:
+    name: build static docs
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+        python-version: ["3.11"]
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
+          fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Build docs
+        run: |
+          make docs-build
+          touch docs/.nojekyll
+          echo "FLUVIO_PYTHON_CLIENT_VERSION=$(venv/bin/python setup.py --version 2> /dev/null)" >> $GITHUB_ENV
+
+      - uses: actions/upload-artifact@v3
+        with:
+          name: docs
+          path: docs
+
+  publish_docs_to_pages:
+    needs: [build_docs]
+    name: push static docs
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
+          fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
+
+      - uses: actions/download-artifact@v3
+        with:
+          name: docs
+          path: docs-latest
+
+      - name: "Git Fetch & Checkout"
+        run: |
+          git config --local user.email "team@fluvio.io"
+          git config --local user.name "Fluvio Authors"
+          git fetch --all
+          git checkout -b docs --track origin/docs
+          git merge -X theirs origin/main -m "Merge remote-tracking branch 'origin/main into docs" --allow-unrelated-histories
+
+      - name: Commit files
+        run: |
+          git add --force docs
+          git commit -m "Updated Fluvio Python client docs" -a || true
+
+      - name: Push changes
+        if: github.event_name == 'workflow_dispatch'
+        uses: ad-m/github-push-action@master
+        with:
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+          branch: docs
+
+  upload_to_github_releases:
+    needs: [build_wheels, build_sdist, build_cc_wheels, build_docs]
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: wheel
+          path: dist
+
+      - uses: actions/download-artifact@v3
+        with:
+          name: docs
+          path: docs
+
+      - name: Release
+        uses: softprops/action-gh-release@v1
+        if: github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch'
+        with:
+          name: latest
+          prerelease: true
+          files: |
+            dist/*
+            docs
+
+      - name: Release
+        uses: softprops/action-gh-release@v1
+        if: github.event_name == 'workflow_dispatch'
+        with:
+          name: ${{ github.FLUVIO_PYTHON_CLIENT_VERSION }}
+          files: |
+            dist/*
+            docs
diff --git a/Makefile b/Makefile
index d216bb04..d750d6af 100644
--- a/Makefile
+++ b/Makefile
@@ -50,11 +50,13 @@ manylinux2014_aarch64:
 manylinux2014_x86_64:
 	python setup.py bdist_wheel --py-limited-api=cp38 --plat-name manylinux2014_x86_64
 
+PDOC_OPTS=--logo='https://www.fluvio.io/images/assets/fluvio-with-text.svg' --favicon='https://www.fluvio.io/images/favicon.ico'
+
 docs-serve: venv-pip build-dev
-	$(PYTHON) -m pdoc fluvio
+	$(PYTHON) -m pdoc fluvio $(PDOC_OPTS)
 
 docs-build: venv-pip build-dev
-	$(PYTHON) -m pdoc fluvio -o docs
+	$(PYTHON) -m pdoc fluvio -o docs/ $(PDOC_OPTS)
 
 clean:
 	rm -rf venv fluvio/*.so target dist build


Test patch:
diff --git a/integration-tests/test_fluvio_python.py b/integration-tests/test_fluvio_python.py
index 44a94087..c1aaf441 100644
--- a/integration-tests/test_fluvio_python.py
+++ b/integration-tests/test_fluvio_python.py
@@ -9,22 +9,22 @@
 def create_topic(topic):
     import subprocess
 
-    subprocess.run("fluvio topic create %s" % topic, shell=True)
+    subprocess.run(["fluvio", "topic", "create", topic], shell=True).check_returncode()
 
 
 def delete_topic(topic):
     import subprocess
 
-    subprocess.run("fluvio topic delete %s" % topic, shell=True)
+    subprocess.run(["fluvio", "topic", "delete", topic], shell=True).check_returncode()
 
 
 def create_smartmodule(sm_name, sm_path):
     import subprocess
 
     subprocess.run(
-        "fluvio smartmodule create %s --wasm-file %s" % (sm_name, sm_path), shell=True
-    )
-    subprocess.run("fluvio smartmodule list", shell=True)
+        ["fluvio", "smartmodule", "create", sm_name, "--wasm-file", sm_path], shell=True
+    ).check_returncode()
+    subprocess.run(["fluvio", "smartmodule", "list"], shell=True)
 
 
 def delete_smartmodule(sm_name):