diff --git a/.github/workflows/update-python-platform.yaml b/.github/workflows/update-python-platform.yaml new file mode 100644 index 0000000000..aff2e650d7 --- /dev/null +++ b/.github/workflows/update-python-platform.yaml @@ -0,0 +1,45 @@ +name: Update func-python version in embedded templates + +permissions: + contents: write + pull-requests: write + +on: + schedule: + - cron: "0 6 * * *" # Daily at 06:00. + workflow_dispatch: # Manual workflow trigger + +jobs: + update: + name: Update func-python version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: knative/actions/setup-go@main + + - name: Run update script + run: go run ./hack/cmd/update-python-platform/main.go + + - name: Run make generate + run: make generate/zz_filesystem_generated.go + + - name: Run smoke tests + run: make test-python + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ github.token }} + commit-message: 'chore: update func-python version' + title: 'chore: update func-python version' + body: | + This PR updates the func-python version in the Python scaffolding templates to the latest version available on PyPI. + + This PR was automatically generated by the [update-python-platform workflow](https://github.com/${{ github.repository }}/actions/workflows/update-python-platform.yaml). + branch: update-func-python + delete-branch: true + committer: Knative Automation + author: Knative Automation + assignees: gauron99, matejvasek, lkingland + base: main diff --git a/hack/cmd/update-python-platform/main.go b/hack/cmd/update-python-platform/main.go new file mode 100644 index 0000000000..d928c39f38 --- /dev/null +++ b/hack/cmd/update-python-platform/main.go @@ -0,0 +1,153 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "os" + "os/signal" + "regexp" + "syscall" +) + +const ( + funcPythonPackage = "func-python" + funcPythonVersionRegex = `"func-python[~^=>