From 1013603c6604a9fd2eb2c52157b0fb46ebe3f2cb Mon Sep 17 00:00:00 2001 From: Giselle van Dongen Date: Mon, 14 Sep 2026 15:46:49 +0200 Subject: [PATCH] Update go tunnel deps in CI --- .github/workflows/pre-release.yml | 19 +++++++++++++------ .tools/update_go_examples.sh | 25 +++++++++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 78464ce1..9610413c 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -15,6 +15,10 @@ on: description: "sdk-go version (without the prepending v). Leave empty if you do not want to update it." required: false type: string + sdkGoTunnelVersion: + description: "Go tunnel module version (without prepending v). Leave empty to keep the current version." + required: false + type: string sdkPythonVersion: description: "sdk-python version (without prepending v). Leave empty if you do not want to update it." required: false @@ -151,16 +155,19 @@ jobs: add-paths: ${{ steps.changes.outputs.paths }} go: - if: github.repository_owner == 'restatedev' && inputs.sdkGoVersion != '' + if: github.repository_owner == 'restatedev' && (inputs.sdkGoVersion != '' || inputs.sdkGoTunnelVersion != '') runs-on: ubuntu-latest timeout-minutes: 40 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" - - name: Bump sdk-go - run: ./.tools/update_go_examples.sh ${{ inputs.sdkGoVersion }} + go-version-file: go/templates/go-kubernetes/go.mod + - name: Bump Go dependencies + env: + SDK_GO_VERSION: ${{ inputs.sdkGoVersion }} + SDK_GO_TUNNEL_VERSION: ${{ inputs.sdkGoTunnelVersion }} + run: ./.tools/update_go_examples.sh "$SDK_GO_VERSION" "$SDK_GO_TUNNEL_VERSION" - name: Compute paths to commit id: changes run: | @@ -173,8 +180,8 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: - title: "[GithubActions] Update SDK-Go ${{ inputs.sdkGoVersion }}" - commit-message: "[GithubActions] Update SDK-Go ${{ inputs.sdkGoVersion }}" + title: "[GithubActions] Update Go dependencies ${{ inputs.sdkGoVersion != '' && format('SDK {0}', inputs.sdkGoVersion) || '' }} ${{ inputs.sdkGoTunnelVersion != '' && format('Tunnel {0}', inputs.sdkGoTunnelVersion) || '' }}" + commit-message: "[GithubActions] Update Go dependencies ${{ inputs.sdkGoVersion != '' && format('SDK {0}', inputs.sdkGoVersion) || '' }} ${{ inputs.sdkGoTunnelVersion != '' && format('Tunnel {0}', inputs.sdkGoTunnelVersion) || '' }}" branch: pre-release/go add-paths: ${{ steps.changes.outputs.paths }} diff --git a/.tools/update_go_examples.sh b/.tools/update_go_examples.sh index cbd72a43..afc23210 100755 --- a/.tools/update_go_examples.sh +++ b/.tools/update_go_examples.sh @@ -2,23 +2,36 @@ set -eufx -o pipefail -NEW_VERSION=v$1 +SDK_VERSION=${1:-} +TUNNEL_VERSION=${2:-} SELF_PATH=${BASH_SOURCE[0]:-"$(command -v -- "$0")"} PROJECT_ROOT="$(dirname "$SELF_PATH")/.." function bump_go_sdk() { - pushd $1 - go get github.com/restatedev/sdk-go@$NEW_VERSION + local project_dir=$1 + local modules=() + if [[ -n "$SDK_VERSION" ]]; then + modules+=("github.com/restatedev/sdk-go@v${SDK_VERSION#v}") + fi + if [[ -n "$TUNNEL_VERSION" ]] && grep -Eq '^[[:space:]]*(require[[:space:]]+)?github.com/restatedev/sdk-go/x/tunnel[[:space:]]' "$project_dir/go.mod"; then + modules+=("github.com/restatedev/sdk-go/x/tunnel@v${TUNNEL_VERSION#v}") + fi + if [[ ${#modules[@]} -eq 0 ]]; then + return + fi + + pushd "$project_dir" + go get "${modules[@]}" go mod tidy + go test ./... # If this is a template directory and has existing agents documentation, update it - local project_dir=$1 - if [[ "$project_dir" == *"/templates/"* ]] && [ -f "./.cursor/rules/AGENTS.md" ]; then + if [[ -n "$SDK_VERSION" && "$project_dir" == *"/templates/"* ]] && [ -f "./.cursor/rules/AGENTS.md" ]; then echo "Updating agents documentation for template in $project_dir" wget -O "./.cursor/rules/AGENTS.md" https://docs.restate.dev/develop/go/agents.md fi - if [[ "$project_dir" == *"/templates/"* ]] && [ -f "./.claude/CLAUDE.md" ]; then + if [[ -n "$SDK_VERSION" && "$project_dir" == *"/templates/"* ]] && [ -f "./.claude/CLAUDE.md" ]; then echo "Updating agents documentation for template in $project_dir" wget -O "./.claude/CLAUDE.md" https://docs.restate.dev/develop/go/agents.md fi