From 87589bb3d0a3c52470f05627ef99ee07ad1b7ea6 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:24:16 +0300 Subject: [PATCH 01/12] Docs publishing --- .github/workflows/docs-publish.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/docs-publish.yml diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml new file mode 100644 index 0000000..2c76852 --- /dev/null +++ b/.github/workflows/docs-publish.yml @@ -0,0 +1,12 @@ +name: "Docs publishing" +on: +- pull_request + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: ammaraskar/sphinx-action@master + with: + docs-folder: "docs/" \ No newline at end of file From de21d748cb05b1aa90a5ec4ea45f90af2f0deb8c Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:30:45 +0300 Subject: [PATCH 02/12] Docs publishing --- .github/workflows/docs-publish.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 2c76852..a69f83d 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -1,12 +1,24 @@ -name: "Docs publishing" -on: -- pull_request +name: "Sphinx: Render docs" + +on: push jobs: - docs: + build: runs-on: ubuntu-latest + permissions: + contents: write steps: - - uses: actions/checkout@v1 - - uses: ammaraskar/sphinx-action@master + - uses: actions/checkout@v4 + - name: Build HTML + uses: ammaraskar/sphinx-action@master + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: html-docs + path: docs/build/html/ + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' with: - docs-folder: "docs/" \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html \ No newline at end of file From 369c994ebc7a34981cf3b73ba0fa5f61ea48515c Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:33:49 +0300 Subject: [PATCH 03/12] Docs publishing --- .github/workflows/docs-publish.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index a69f83d..9336b3e 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -9,6 +9,9 @@ jobs: contents: write steps: - uses: actions/checkout@v4 + - name: Install requirements + run: + pip install -r docs/source/requirements.txt - name: Build HTML uses: ammaraskar/sphinx-action@master - name: Upload artifacts From ad18bcd989a4d3f08c599faf1be5143e84fc5e22 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:37:02 +0300 Subject: [PATCH 04/12] Docs publishing --- docs/source/conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 36e6091..d37c7ef 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,6 +5,7 @@ import os import sys +from datetime import datetime sys.path.insert(0, os.path.abspath('../..')) @@ -14,7 +15,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = 'Py-SPW' -copyright = '2023, Teleport' +copyright = f'{datetime.now().year}, Teleport' author = 'Teleport' release = __version__ @@ -23,6 +24,7 @@ extensions = [ "sphinx.ext.autodoc", + "furo", ] templates_path = ['_templates'] From e9d9d4cecb3b276ca63d5e0870c278711b3ac136 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:39:49 +0300 Subject: [PATCH 05/12] Docs publishing --- .github/workflows/docs-publish.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 9336b3e..5d2e296 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -10,8 +10,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install requirements - run: - pip install -r docs/source/requirements.txt + run: | + pip install -r ./docs/source/requirements.txt + pip install -r ./requirements.txt + python -c "import furo" - name: Build HTML uses: ammaraskar/sphinx-action@master - name: Upload artifacts From cfb5ef7e20ea5c9826f13c01bc10d564c1016518 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:43:03 +0300 Subject: [PATCH 06/12] Docs publishing --- docs/source/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/requirements.txt b/docs/source/requirements.txt index 07dd8ee..2ad69cb 100644 --- a/docs/source/requirements.txt +++ b/docs/source/requirements.txt @@ -1 +1,2 @@ +sphinx==5.3.0 furo==2023.3.27 \ No newline at end of file From 925757b45fd558552fed284da0fe355403910491 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:49:32 +0300 Subject: [PATCH 07/12] Docs publishing --- .github/workflows/docs-publish.yml | 8 ++++---- docs/source/conf.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 5d2e296..cca899b 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -9,18 +9,18 @@ jobs: contents: write steps: - uses: actions/checkout@v4 - - name: Install requirements + - name: Build docs run: | pip install -r ./docs/source/requirements.txt pip install -r ./requirements.txt - python -c "import furo" - - name: Build HTML - uses: ammaraskar/sphinx-action@master + sphinx-build -M html docs/source docs/build + - name: Upload artifacts uses: actions/upload-artifact@v3 with: name: html-docs path: docs/build/html/ + - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: github.ref == 'refs/heads/main' diff --git a/docs/source/conf.py b/docs/source/conf.py index d37c7ef..38909f4 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,6 @@ extensions = [ "sphinx.ext.autodoc", - "furo", ] templates_path = ['_templates'] From 6bf005f0c1ef4ae2cf1b321c53591e25f8d153c2 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:51:37 +0300 Subject: [PATCH 08/12] Docs publishing --- .github/workflows/docs-publish.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index cca899b..f030c04 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -23,7 +23,6 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@v3 - if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/build/html \ No newline at end of file From 7ef60519cf6fb8835e36e9266eacfd9968d57416 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:01:35 +0300 Subject: [PATCH 09/12] Docs publishing on only main branch --- .github/workflows/docs-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index f030c04..cca899b 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -23,6 +23,7 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/build/html \ No newline at end of file From b4b98661ab6a1e2968a6c109799ddbdd770aa79a Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:05:55 +0300 Subject: [PATCH 10/12] Test Pypi publish only on pull requests. --- .github/workflows/pypi-publish.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 81eaebc..ec0620d 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,9 +1,9 @@ name: Publish Package -on: push +on: pull env: - version: ${{ github.run_id }}-${{ github.run_attempt }} + version: ${{ github.run_id }}.post${{ github.run_attempt }} jobs: build: @@ -74,3 +74,7 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ + - name: Test + run: | + echo Release published on https://test.pypi.org/project/Py-SPW/$version/ + echo Install - pip install -i https://test.pypi.org/simple/ Py-SPW==$version From ad2c3970f24eb262d01aee8e1c511a7390efe0e6 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:09:23 +0300 Subject: [PATCH 11/12] Test Pypi publish only on pull requests. --- .github/workflows/pypi-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index ec0620d..e97720a 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,6 +1,6 @@ name: Publish Package -on: pull +on: push env: version: ${{ github.run_id }}.post${{ github.run_attempt }} @@ -63,6 +63,7 @@ jobs: permissions: id-token: write # IMPORTANT: mandatory for trusted publishing + if: github.event_name == 'pull_request' steps: - name: Download all the dists From e215dca5de4c124004a25ab26cd4476c7a1a4ca5 Mon Sep 17 00:00:00 2001 From: Teleport <77507478+teleportx@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:16:33 +0300 Subject: [PATCH 12/12] Test Pypi publish only on push in dev --- .github/workflows/{pypi-publish.yml => test-pypi-publish.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{pypi-publish.yml => test-pypi-publish.yml} (97%) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/test-pypi-publish.yml similarity index 97% rename from .github/workflows/pypi-publish.yml rename to .github/workflows/test-pypi-publish.yml index e97720a..3c4ae9e 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/test-pypi-publish.yml @@ -63,7 +63,7 @@ jobs: permissions: id-token: write # IMPORTANT: mandatory for trusted publishing - if: github.event_name == 'pull_request' + if: github.ref == 'refs/heads/dev' steps: - name: Download all the dists