From 493332a9b884681ceda53e8838c5e73c92555def Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Apr 2026 04:51:40 +0000 Subject: [PATCH 1/2] fix: lower hatch version requirement to match available releases Agent-Logs-Url: https://github.com/PyMCU/pymcu-sdk/sessions/8fce56bc-adb5-45e5-a083-751f37236b95 Co-authored-by: begeistert <36460223+begeistert@users.noreply.github.com> --- .github/workflows/build-python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml index a6977de..8cf6415 100644 --- a/.github/workflows/build-python.yml +++ b/.github/workflows/build-python.yml @@ -24,7 +24,7 @@ jobs: with: python-version: "3.11" - name: Install Hatch - run: pip install "hatch>=1.25.0" + run: pip install "hatch>=1.0.0" - name: Build run: hatch build - name: Upload artifacts From c98c4592d92b84726039633d08f061faf7416584 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Apr 2026 05:00:06 +0000 Subject: [PATCH 2/2] feat: add publish jobs for private (headscale) and public registries Agent-Logs-Url: https://github.com/PyMCU/pymcu-sdk/sessions/75b3043f-d6d8-45ae-845b-45299360338f Co-authored-by: begeistert <36460223+begeistert@users.noreply.github.com> --- .github/workflows/build-csharp.yml | 69 ++++++++++++++++++++++++++++++ .github/workflows/build-python.yml | 59 +++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/.github/workflows/build-csharp.yml b/.github/workflows/build-csharp.yml index ef78c7e..008633f 100644 --- a/.github/workflows/build-csharp.yml +++ b/.github/workflows/build-csharp.yml @@ -7,6 +7,8 @@ on: - "src/csharp/**" - "PyMCU.SDK.slnx" - ".github/workflows/build-csharp.yml" + tags: + - "v*" pull_request: branches: [main] paths: @@ -18,6 +20,8 @@ jobs: build: name: Build & pack NuGet runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout @@ -49,3 +53,68 @@ jobs: if-no-files-found: error retention-days: 30 + publish-private: + name: Publish to private NuGet feed + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref_type == 'branch' + permissions: + contents: read + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: PyMCU.Backend.SDK-nupkg + path: artifacts/ + + - name: Connect to headscale network + uses: tailscale/github-action@v3 + with: + authkey: ${{ secrets.HEADSCALE_AUTH_KEY }} + login-server: ${{ secrets.HEADSCALE_URL }} + + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + + - name: Publish to private NuGet feed + env: + PRIVATE_NUGET_URL: ${{ secrets.PRIVATE_NUGET_URL }} + PRIVATE_NUGET_API_KEY: ${{ secrets.PRIVATE_NUGET_API_KEY }} + run: | + dotnet nuget push artifacts/*.nupkg \ + --source "$PRIVATE_NUGET_URL" \ + --api-key "$PRIVATE_NUGET_API_KEY" \ + --skip-duplicate + + publish-public: + name: Publish to NuGet.org + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref_type == 'tag' + environment: nuget + permissions: + contents: read + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: PyMCU.Backend.SDK-nupkg + path: artifacts/ + + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + + - name: Publish to NuGet.org + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: | + dotnet nuget push artifacts/*.nupkg \ + --source https://api.nuget.org/v3/index.json \ + --api-key "$NUGET_API_KEY" \ + --skip-duplicate diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml index 8cf6415..825dc75 100644 --- a/.github/workflows/build-python.yml +++ b/.github/workflows/build-python.yml @@ -6,16 +6,21 @@ on: - "src/python/**" - "pyproject.toml" - ".github/workflows/build-python.yml" + tags: + - "v*" pull_request: branches: [main] paths: - "src/python/**" - "pyproject.toml" - ".github/workflows/build-python.yml" + jobs: build: name: Build wheel & sdist runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout uses: actions/checkout@v4 @@ -34,3 +39,57 @@ jobs: path: dist/ if-no-files-found: error retention-days: 30 + + publish-private: + name: Publish to private PyPI + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref_type == 'branch' + permissions: + contents: read + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: pymcu-plugin-sdk-dist + path: dist/ + + - name: Connect to headscale network + uses: tailscale/github-action@v3 + with: + authkey: ${{ secrets.HEADSCALE_AUTH_KEY }} + login-server: ${{ secrets.HEADSCALE_URL }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Twine + run: pip install twine + + - name: Publish to private registry + env: + TWINE_REPOSITORY_URL: ${{ secrets.PRIVATE_PYPI_URL }} + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PRIVATE_PYPI_TOKEN }} + run: twine upload dist/* + + publish-public: + name: Publish to PyPI + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref_type == 'tag' + environment: pypi + permissions: + contents: read + id-token: write + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: pymcu-plugin-sdk-dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1